01b4d1dbf86b52daa49cf17744625349558d1890 angie Mon Sep 17 09:58:51 2012 -0700 Expose vcfFilePooledStr to callers (for example to share allele storage). diff --git src/lib/vcf.c src/lib/vcf.c index 8cc0cd8..1176273 100644 --- src/lib/vcf.c +++ src/lib/vcf.c @@ -171,57 +171,57 @@ va_list args; va_start(args, format); char formatPlus[1024]; if (vcff->lf != NULL) sprintf(formatPlus, "%s:%d: %s", vcff->lf->fileName, vcff->lf->lineIx, format); else strcpy(formatPlus, format); vaWarn(formatPlus, args); va_end(args); vcff->errCnt++; if (vcfFileStopDueToErrors(vcff)) errAbort("VCF: %d parser errors, quitting", vcff->errCnt); } static void *vcfFileAlloc(struct vcfFile *vcff, size_t size) -/* allocate memory from the memory pool */ +/* Use vcff's local mem to allocate memory. */ { return lmAlloc(vcff->pool->lm, size); } static char *vcfFileCloneStrZ(struct vcfFile *vcff, char *str, size_t size) -/* allocate memory for a string and copy it */ +/* Use vcff's local mem to allocate memory for a string and copy it. */ { return lmCloneStringZ(vcff->pool->lm, str, size); } static char *vcfFileCloneStr(struct vcfFile *vcff, char *str) -/* allocate memory for a string and copy it */ +/* Use vcff's local mem to allocate memory for a string and copy it. */ { return vcfFileCloneStrZ(vcff, str, strlen(str)); } static char *vcfFileCloneSubstr(struct vcfFile *vcff, char *line, regmatch_t substr) /* Allocate memory for and copy a substring of line. */ { return vcfFileCloneStrZ(vcff, line+substr.rm_so, (substr.rm_eo - substr.rm_so)); } #define vcfFileCloneVar(var) lmCloneMem(vcff->pool->lm, var, sizeof(var)); -static char *vcfFilePooledStr(struct vcfFile *vcff, char *str) -/* allocate memory for a string from the shared string pool */ +char *vcfFilePooledStr(struct vcfFile *vcff, char *str) +/* Allocate memory for a string from vcff's shared string pool. */ { return hashStoreName(vcff->pool, str); } static enum vcfInfoType vcfInfoTypeFromSubstr(struct vcfFile *vcff, char *line, regmatch_t substr) /* Translate substring of line into vcfInfoType or complain. */ { char typeWord[16]; int substrLen = substr.rm_eo - substr.rm_so; if (substrLen > sizeof(typeWord) - 1) { vcfFileErr(vcff, "substring passed to vcfInfoTypeFromSubstr is too long."); return vcfInfoNoType; } safencpy(typeWord, sizeof(typeWord), line + substr.rm_so, substrLen);