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

Function sarrayAddString

deps/leptonica/src/sarray1.c:445–472  ·  view source on GitHub ↗

! * \brief sarrayAddString() * * \param[in] sa string array * \param[in] string string to be added * \param[in] copyflag L_INSERT, L_NOCOPY or L_COPY * \return 0 if OK, 1 on error * * * Notes: * (1) See usage comments at the top of this file. L_INSERT is * equivalent to L_NOCOPY. * */

Source from the content-addressed store, hash-verified

443 * </pre>
444 */
445l_int32
446sarrayAddString(SARRAY *sa,
447 char *string,
448 l_int32 copyflag)
449{
450l_int32 n;
451
452 PROCNAME("sarrayAddString");
453
454 if (!sa)
455 return ERROR_INT("sa not defined", procName, 1);
456 if (!string)
457 return ERROR_INT("string not defined", procName, 1);
458 if (copyflag != L_INSERT && copyflag != L_NOCOPY && copyflag != L_COPY)
459 return ERROR_INT("invalid copyflag", procName, 1);
460
461 n = sarrayGetCount(sa);
462 if (n >= sa->nalloc)
463 sarrayExtendArray(sa);
464
465 if (copyflag == L_COPY)
466 sa->array[n] = stringNew(string);
467 else /* L_INSERT or L_NOCOPY */
468 sa->array[n] = string;
469 sa->n++;
470
471 return 0;
472}
473
474
475/*!

Callers 15

generateFixedStringsPdfFunction · 0.85
generatePageStringPdfFunction · 0.85
generateContentStringPdfFunction · 0.85
generatePreXStringsPdfFunction · 0.85
makeTrailerStringPdfFunction · 0.85
parseForProtosFunction · 0.85
captureProtoSignatureFunction · 0.85
cleanProtoSignatureFunction · 0.85
fmorphautogen1Function · 0.85
fmorphautogen2Function · 0.85

Calls 3

sarrayGetCountFunction · 0.85
sarrayExtendArrayFunction · 0.85
stringNewFunction · 0.85

Tested by

no test coverage detected