1b20a1774021cdcb07303801d55b7ca3fa6cff09 braney Wed Jan 8 05:54:20 2025 -0800 fix up chop functions so they don't call ArraySize with NULL diff --git src/hg/snp/snpLoad/snpNcbiToUcsc.c src/hg/snp/snpLoad/snpNcbiToUcsc.c index b28a820..a441dd5 100644 --- src/hg/snp/snpLoad/snpNcbiToUcsc.c +++ src/hg/snp/snpLoad/snpNcbiToUcsc.c @@ -1722,51 +1722,51 @@ } void checkSubmitters(struct lineFile *lf, int *pSubmitterCount, char *submitters) /* Make sure submitterCount matches count of comma-sep'd strings in submitters. */ { if (*pSubmitterCount < 0) { warn("Looks like submitterCount is missing/NULL for rs%d -- check completeness " "of ids in SNPSubSNPLink, SubSNP and Batch, and email dbSNP", rsId); *pSubmitterCount = 0; submitters[0] = '\0'; // instead of "NULL" return; } // subtract one because of comma at end: -int checkCount = chopCommas(submitters, NULL) - 1; +int checkCount = chopCommasLen(submitters) - 1; if (checkCount != *pSubmitterCount) lineFileAbort(lf, "submitterCount %d does not match number of comma-separated " "strings %d in submitters (%s) for rs%d. Check doDbSnp.pl's code that " "processes submitter data into ucscHandles.", *pSubmitterCount, checkCount, submitters, rsId); } void processAlleleFreqs(struct lineFile *lf, int *pAlleleFreqCount, char *alleles, float *alleleNs, float *alleleFreqs) /* Make sure alleleFreqCount matches count of comma-sep'd strings in alleles. * If any alleleNs are non-integer, flag exception. If alleleFreqs don't sum to * 1.0, flag an error. */ { if (*pAlleleFreqCount < 0) { *pAlleleFreqCount = 0; alleles[0] = '\0'; return; } -int checkCount = chopCommas(alleles, NULL) - 1; +int checkCount = chopCommasLen(alleles) - 1; if (checkCount != *pAlleleFreqCount) lineFileAbort(lf, "alleleFreqCount %d does not match number of comma-separated " "strings %d in alleles (%s)", *pAlleleFreqCount, checkCount, alleles); // Length of alleleNs and alleleFreqs was already checked during parsing. int i; double total = 0.0; boolean nonIntChromCount = FALSE; for (i=0; i < *pAlleleFreqCount; i++) { double leftover = alleleNs[i] - trunc(alleleNs[i]); if (leftover > ALLELE_N_ROUNDING_ERROR && leftover < 1.0-ALLELE_N_ROUNDING_ERROR) nonIntChromCount = TRUE; if (alleleFreqs != NULL) total += alleleFreqs[i]; }