61dc7885a5f1001e2bc189501379088f2b53379d galt Mon Feb 23 15:42:36 2026 -0800 fixes things found automated codereview. for bigBedCmdSupport lib moved slAddHead, removed stray debugmsg and fixed comment and added static keyword. fixed bigChainToChain chromFound = FALSE, removed stray test makefile, fixed existing typo "tines", and added a missing space after issing space before optionMultiVal(). refs #37146 diff --git src/lib/bigBedCmdSupport.c src/lib/bigBedCmdSupport.c index 32235727e69..92401e9a21e 100644 --- src/lib/bigBedCmdSupport.c +++ src/lib/bigBedCmdSupport.c @@ -51,91 +51,89 @@ } return chromHash; } static struct bed *bed3FromPositionString(char *line) /* Read positions line and return bed 3. */ { char *chrom; int start, end; struct bed *bed = NULL; /* Convert input to bed record */ char *val = cloneString(line); mustParseRange(val, &chrom, &start, &end); // does not subtract 1 - verbose(1,"bed3FromPositionString after mustParseRange chrom=%s\n", chrom); // used to use parseRegion which checks for overflow, // but only catches start < 1 because of integer overflow. if (start < 1) errAbort("invalid range, start=%d < 1, but first base is 1 or more", start); --start; if (start > end) errAbort("invalid range, (start - 1)=%d > end=%d", start, end); AllocVar(bed); bed->chrom=cloneString(chrom); bed->chromStart=start; bed->chromEnd=end; freez(&val); return bed; } struct bed *bed3FromPositions(char *fileName) /* Read positions file and retrun bed 3 list. */ { struct lineFile *lf = lineFileOpen(fileName, TRUE); struct bed *bed = NULL, *bedList = NULL; char *line; /* Convert input to bed file */ while (lineFileNextReal(lf, &line)) { bed = bed3FromPositionString(line); - } slAddHead(&bedList, bed); + } lineFileClose(&lf); return bedList; } -struct bed *bedLoad3Plus(char *fileName) +static struct bed *bedLoad3Plus(char *fileName) /* Determines how many fields are in a bedFile and load all beds from * a tab-separated file. Dispose of this with bedFreeList(). * Small change by Michael to require only 3 or more fields. Meaning we will accept bed3 */ { struct bed *list = NULL; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *line, *row[bedKnownFields]; while (lineFileNextReal(lf, &line)) { int numFields = chopByWhite(line, row, ArraySize(row)); if (numFields < 3) errAbort("file %s doesn't appear to be in bed format. At least 3 fields required, got %d", fileName, numFields); slAddHead(&list, bedLoadN(row, numFields)); } lineFileClose(&lf); slReverse(&list); return list; } struct bed *bedLoad3FromRangeOption(struct slName *ranges) /* Determines how many fields are in a bedFile and load all beds from - * a tab-separated file. Dispose of this with bedFreeList(). - * Small change by Michael to require only 3 or more fields. Meaning we will accept bed3 + * possibly multiple -range parameters. Dispose of this with bedFreeList(). */ { struct slName *range = NULL; struct bed *bed, *list = NULL; char *row[bedKnownFields]; for(range=ranges; range; range=range->next) { if (strchr(range->name, ':')) { bed = bed3FromPositionString(range->name); } else { char *val=cloneString(range->name);