MCPcopy Create free account
hub / github.com/creatale/node-dv / getNextNonCommentLine

Function getNextNonCommentLine

deps/leptonica/src/parseprotos.c:224–253  ·  view source on GitHub ↗

* getNextNonCommentLine() * * Input: sa (output from cpp, by line) * start (starting index to search) * &next ( index of first uncommented line after * the start line) * Return: 0 if OK, 1 on error * * Notes: * (1) Skips over all consecutive comment lines, beginning at 'start' * (2) If all lines to the end are '

Source from the content-addressed store, hash-verified

222 * (2) If all lines to the end are '#' comments, return next = -1
223 */
224static l_int32
225getNextNonCommentLine(SARRAY *sa,
226 l_int32 start,
227 l_int32 *pnext)
228{
229char *str;
230l_int32 i, n;
231
232 PROCNAME("getNextNonCommentLine");
233
234 if (!sa)
235 return ERROR_INT("sa not defined", procName, 1);
236 if (!pnext)
237 return ERROR_INT("&pnext not defined", procName, 1);
238
239 /* Init for situation where this line and all following are comments */
240 *pnext = -1;
241
242 n = sarrayGetCount(sa);
243 for (i = start; i < n; i++) {
244 if ((str = sarrayGetString(sa, i, L_NOCOPY)) == NULL)
245 return ERROR_INT("str not returned; shouldn't happen", procName, 1);
246 if (str[0] != '#') {
247 *pnext = i;
248 return 0;
249 }
250 }
251
252 return 0;
253}
254
255
256/*

Callers 1

searchForProtoSignatureFunction · 0.85

Calls 2

sarrayGetCountFunction · 0.85
sarrayGetStringFunction · 0.85

Tested by

no test coverage detected