#include "common.h"#include "errabort.h"#include "portable.h"#include "linefile.h"Include dependency graph for common.c:

Go to the source code of this file.
Functions | |
| void * | cloneMem (void *pt, size_t size) |
| char * | cloneStringZ (char *s, int size) |
| char * | cloneString (char *s) |
| char * | cloneLongString (char *s) |
| void | zeroBytes (void *vpt, int count) |
| void | reverseBytes (char *bytes, long length) |
| void | reverseInts (int *a, int length) |
| void | reverseUnsigned (unsigned *a, int length) |
| void | reverseDoubles (double *a, int length) |
| void | reverseStrings (char **a, int length) |
| void | swapBytes (char *a, char *b, int length) |
| int | slCount (void *list) |
| void * | slElementFromIx (void *list, int ix) |
| int | slIxFromElement (void *list, void *el) |
| void * | slLastEl (void *list) |
| void | slAddTail (void *listPt, void *node) |
| void | slSafeAddHead (void *listPt, void *node) |
| void * | slPopHead (void *vListPt) |
| void * | slPopTail (void *vListPt) |
| void * | slCat (void *va, void *vb) |
| void | slReverse (void *listPt) |
| void | slFreeList (void *listPt) |
| void | slSort (void *pList, int(*compare)(const void *elem1, const void *elem2)) |
| void | slUniqify (void *pList, int(*compare)(const void *elem1, const void *elem2), void(*free)()) |
| boolean | slRemoveEl (void *vpList, void *vToRemove) |
| slInt * | slIntNew (int x) |
| int | slIntCmp (const void *va, const void *vb) |
| int | slIntCmpRev (const void *va, const void *vb) |
| static int | doubleCmp (const void *va, const void *vb) |
| void | doubleSort (int count, double *array) |
| double | doubleMedian (int count, double *array) |
| slDouble * | slDoubleNew (double x) |
| int | slDoubleCmp (const void *va, const void *vb) |
| double | slDoubleMedian (struct slDouble *list) |
| static int | intCmp (const void *va, const void *vb) |
| void | intSort (int count, int *array) |
| int | intMedian (int count, int *array) |
| slName * | newSlName (char *name) |
| slName * | slNameNewN (char *name, int size) |
| int | slNameCmpCase (const void *va, const void *vb) |
| void | slNameSortCase (struct slName **pList) |
| int | slNameCmp (const void *va, const void *vb) |
| void | slNameSort (struct slName **pList) |
| boolean | slNameInList (struct slName *list, char *string) |
| void * | slNameFind (void *list, char *string) |
| int | slNameFindIx (struct slName *list, char *string) |
| char * | slNameStore (struct slName **pList, char *string) |
| slName * | slNameAddHead (struct slName **pList, char *name) |
| slName * | slNameAddTail (struct slName **pList, char *name) |
| slName * | slNameCloneList (struct slName *list) |
| slName * | slNameListFromString (char *s, char delimiter) |
| slName * | slNameLoadReal (char *fileName) |
| slRef * | refOnList (struct slRef *refList, void *val) |
| slRef * | slRefNew (void *val) |
| void | refAdd (struct slRef **pRefList, void *val) |
| void | refAddUnique (struct slRef **pRefList, void *val) |
| slRef * | refListFromSlList (void *list) |
| slPair * | slPairNew (char *name, void *val) |
| void | slPairAdd (struct slPair **pList, char *name, void *val) |
| void | slPairFree (struct slPair **pEl) |
| void | slPairFreeList (struct slPair **pList) |
| void | slPairFreeVals (struct slPair *list) |
| void | slPairFreeValsAndList (struct slPair **pList) |
| slPair * | slPairFind (struct slPair *list, char *name) |
| void * | slPairFindVal (struct slPair *list, char *name) |
| void | gentleFree (void *pt) |
| int | differentWord (char *s1, char *s2) |
| int | differentStringNullOk (char *a, char *b) |
| boolean | startsWith (char *start, char *string) |
| boolean | startsWithWord (char *firstWord, char *line) |
| char * | rStringIn (char *needle, char *haystack) |
| char * | stringBetween (char *start, char *end, char *haystack) |
| boolean | endsWith (char *string, char *end) |
| char | lastChar (char *s) |
| char * | memMatch (char *needle, int nLen, char *haystack, int hLen) |
| void | toUpperN (char *s, int n) |
| void | toLowerN (char *s, int n) |
| void | toggleCase (char *s, int size) |
| void | touppers (char *s) |
| char * | replaceChars (char *string, char *old, char *new) |
| void | tolowers (char *s) |
| void | subChar (char *s, char oldChar, char newChar) |
| void | stripChar (char *s, char c) |
| void | stripString (char *s, char *strip) |
| int | countChars (char *s, char c) |
| int | countCharsN (char *s, char c, int size) |
| int | countLeadingChars (char *s, char c) |
| int | countSame (char *a, char *b) |
| int | chopString (char *in, char *sep, char *outArray[], int outSize) |
| int | chopByWhite (char *in, char *outArray[], int outSize) |
| int | chopByChar (char *in, char chopper, char *outArray[], int outSize) |
| char * | skipLeadingSpaces (char *s) |
| char * | skipToSpaces (char *s) |
| void | eraseTrailingSpaces (char *s) |
| void | eraseWhiteSpace (char *s) |
| char * | trimSpaces (char *s) |
| void | spaceOut (FILE *f, int count) |
| void | starOut (FILE *f, int count) |
| boolean | hasWhiteSpace (char *s) |
| char * | firstWordInLine (char *line) |
| char * | lastWordInLine (char *line) |
| char * | nextWord (char **pLine) |
| char * | nextTabWord (char **pLine) |
| int | stringArrayIx (char *string, char *array[], int arraySize) |
| int | ptArrayIx (void *pt, void *array, int arraySize) |
| FILE * | mustOpen (char *fileName, char *mode) |
| void | mustWrite (FILE *file, void *buf, size_t size) |
| void | mustRead (FILE *file, void *buf, size_t size) |
| void | writeString (FILE *f, char *s) |
| char * | readString (FILE *f) |
| char * | mustReadString (FILE *f) |
| boolean | fastReadString (FILE *f, char buf[256]) |
| void | writeBits64 (FILE *f, bits64 x) |
| bits64 | readBits64 (FILE *f) |
| char * | addSuffix (char *head, char *suffix) |
| void | chopSuffix (char *s) |
| void | chopSuffixAt (char *s, char c) |
| char * | chopPrefixAt (char *s, char c) |
| char * | chopPrefix (char *s) |
| boolean | carefulCloseWarn (FILE **pFile) |
| void | carefulClose (FILE **pFile) |
| char * | firstWordInFile (char *fileName, char *wordBuf, int wordBufSize) |
| int | roundingScale (int a, int p, int q) |
| int | intAbs (int a) |
| int | rangeIntersection (int start1, int end1, int start2, int end2) |
| int | positiveRangeIntersection (int start1, int end1, int start2, int end2) |
| bits32 | byteSwap32 (bits32 a) |
| void | removeReturns (char *dest, char *src) |
| char * | readLine (FILE *fh) |
| boolean | fileExists (char *fileName) |
| char * | containsStringNoCase (char *haystack, char *needle) |
| char * | strstrNoCase (char *haystack, char *needle) |
| int | vasafef (char *buffer, int bufSize, char *format, va_list args) |
| int | safef (char *buffer, int bufSize, char *format,...) |
| void | safecpy (char *buf, size_t bufSize, const char *src) |
| void | safencpy (char *buf, size_t bufSize, const char *src, size_t n) |
| void | safecat (char *buf, size_t bufSize, const char *src) |
| void | safencat (char *buf, size_t bufSize, const char *src, size_t n) |
| char * | naForNull (char *s) |
| char * | naForEmpty (char *s) |
| char * | emptyForNull (char *s) |
| char * | nullIfAllSpace (char *s) |
| char * | trueFalseString (boolean b) |
| void | uglyTime (char *label,...) |
| void | makeDirs (char *path) |
| char * | skipNumeric (char *s) |
| char * | skipToNumeric (char *s) |
| char * | splitOffNonNumeric (char *s) |
| char * | splitOffNumber (char *db) |
Variables | |
| static char const | rcsid [] = "$Id: common.c,v 1.108 2007/03/30 00:12:11 markd Exp $" |
| char | crLfChopper [] = "\n\r" |
| char | whiteSpaceChopper [] = " \t\n\r" |
| static char * | naStr = "n/a" |
| static char * | emptyStr = "" |
| char* addSuffix | ( | char * | head, | |
| char * | suffix | |||
| ) |
Definition at line 1613 of file common.c.
References needMem().
Referenced by convertEpsToPdf().
01616 { 01617 char *ret = NULL; 01618 int size = strlen(head) + strlen(suffix) +1; 01619 ret = needMem(sizeof(char)*size); 01620 snprintf(ret, size, "%s%s", head, suffix); 01621 return ret; 01622 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bits32 byteSwap32 | ( | bits32 | a | ) |
Definition at line 1739 of file common.c.
Referenced by nibOpenVerify(), oocMaskCounts(), readBits32(), readBlockCoords(), twoBitOutNBeds(), and twoBitSeqSizeNoNs().
01741 { 01742 union {bits32 whole; UBYTE bytes[4];} u,v; 01743 u.whole = a; 01744 v.bytes[0] = u.bytes[3]; 01745 v.bytes[1] = u.bytes[2]; 01746 v.bytes[2] = u.bytes[1]; 01747 v.bytes[3] = u.bytes[0]; 01748 return v.whole; 01749 }
Here is the caller graph for this function:

| void carefulClose | ( | FILE ** | pFile | ) |
Definition at line 1683 of file common.c.
References carefulCloseWarn(), and noWarnAbort().
Referenced by appendMimeVar(), bigBlat(), dnaMotifToLogoPs(), dnaMotifToLogoPsW(), doBlat(), doDetailLine(), fofClose(), freeWormCdnaIterator(), gfMakeOoc(), gfPcrOutputWriteAll(), hashHisto(), loadNt4(), mafWriteAll(), nibGetSize(), nibInfoFree(), nibOutput(), parseMultiParts(), psClose(), searchOneIndex(), twoBitClose(), wormCdnaUncache(), wormUncacheSomeGdf(), writeGulp(), and xapParseFile().
01686 { 01687 if (!carefulCloseWarn(pFile)) 01688 noWarnAbort(); 01689 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean carefulCloseWarn | ( | FILE ** | pFile | ) |
Definition at line 1661 of file common.c.
References errnoWarn(), FALSE, and TRUE.
Referenced by carefulClose().
01665 { 01666 FILE *f; 01667 boolean ok = TRUE; 01668 if ((pFile != NULL) && ((f = *pFile) != NULL)) 01669 { 01670 if (f != stdin && f != stdout) 01671 { 01672 if (fclose(f) != 0) 01673 { 01674 errnoWarn("fclose failed"); 01675 ok = FALSE; 01676 } 01677 } 01678 *pFile = NULL; 01679 } 01680 return ok; 01681 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int chopByChar | ( | char * | in, | |
| char | chopper, | |||
| char * | outArray[], | |||
| int | outSize | |||
| ) |
Definition at line 1248 of file common.c.
Referenced by lineFileChopCharNext(), lineFileChopNextTab(), nextBlock(), tabRowByChar(), and trixParseHitList().
01250 { 01251 int i; 01252 char c; 01253 if (*in == 0) 01254 return 0; 01255 for (i=0; (i<outSize) || (outArray==NULL); ++i) 01256 { 01257 if (outArray != NULL) 01258 outArray[i] = in; 01259 for (;;) 01260 { 01261 if ((c = *in++) == 0) 01262 return i+1; 01263 else if (c == chopper) 01264 { 01265 if (outArray != NULL) 01266 in[-1] = 0; 01267 break; 01268 } 01269 } 01270 } 01271 return i; 01272 }
Here is the caller graph for this function:

| int chopByWhite | ( | char * | in, | |
| char * | outArray[], | |||
| int | outSize | |||
| ) |
Definition at line 1209 of file common.c.
Referenced by countWordsInFile(), faReadMixedNext(), lineFileChopNext(), mafNextWithPos(), readAllWords(), and tabRowByWhite().
01211 { 01212 int recordCount = 0; 01213 char c; 01214 for (;;) 01215 { 01216 if (outArray != NULL && recordCount >= outSize) 01217 break; 01218 01219 /* Skip initial separators. */ 01220 while (isspace(*in)) ++in; 01221 if (*in == 0) 01222 break; 01223 01224 /* Store start of word and look for end of word. */ 01225 if (outArray != NULL) 01226 outArray[recordCount] = in; 01227 recordCount += 1; 01228 for (;;) 01229 { 01230 if ((c = *in) == 0) 01231 break; 01232 if (isspace(c)) 01233 break; 01234 ++in; 01235 } 01236 if (*in == 0) 01237 break; 01238 01239 /* Tag end of word with zero. */ 01240 if (outArray != NULL) 01241 *in = 0; 01242 /* And skip over the zero. */ 01243 in += 1; 01244 } 01245 return recordCount; 01246 }
Here is the caller graph for this function:

| char* chopPrefix | ( | char * | s | ) |
Definition at line 1650 of file common.c.
References chopPrefixAt().
01655 { 01656 return chopPrefixAt(s, '.'); 01657 }
Here is the call graph for this function:

| char* chopPrefixAt | ( | char * | s, | |
| char | c | |||
| ) |
Definition at line 1641 of file common.c.
Referenced by chopPrefix().
01643 { 01644 char *e = strchr(s, c); 01645 if (e == NULL) return s; 01646 *e++ = 0; 01647 return e; 01648 }
Here is the caller graph for this function:

| int chopString | ( | char * | in, | |
| char * | sep, | |||
| char * | outArray[], | |||
| int | outSize | |||
| ) |
Definition at line 1184 of file common.c.
Referenced by axtScoreSchemeFromBlastzMatrix(), axtScoreSchemeReadLf(), kvtParseAdd(), netParseSubnet(), parseElement(), parsePasvPort(), parseRestOfCdnaInfo(), twoBitSpecNew(), wormGeneToOrfNames(), wormIsGeneName(), wormParseChromRange(), xaReadNext(), and xStitch().
01185 { 01186 int recordCount = 0; 01187 01188 for (;;) 01189 { 01190 if (outArray != NULL && recordCount >= outSize) 01191 break; 01192 /* Skip initial separators. */ 01193 in += strspn(in, sep); 01194 if (*in == 0) 01195 break; 01196 if (outArray != NULL) 01197 outArray[recordCount] = in; 01198 recordCount += 1; 01199 in += strcspn(in, sep); 01200 if (*in == 0) 01201 break; 01202 if (outArray != NULL) 01203 *in = 0; 01204 in += 1; 01205 } 01206 return recordCount; 01207 }
Here is the caller graph for this function:

| void chopSuffix | ( | char * | s | ) |
Definition at line 1624 of file common.c.
Referenced by convertEpsToPdf(), and getHost().
Here is the caller graph for this function:

| void chopSuffixAt | ( | char * | s, | |
| char | c | |||
| ) |
| char* cloneLongString | ( | char * | s | ) |
Definition at line 40 of file common.c.
References cloneMem().
Referenced by htmlPageParse().
00042 { 00043 size_t size = strlen(s); 00044 return cloneMem(s, size+1); 00045 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void* cloneMem | ( | void * | pt, | |
| size_t | size | |||
| ) |
Definition at line 14 of file common.c.
References needLargeMem().
Referenced by axtReadWithPos(), cloneLongString(), faReadAllMixableInLf(), ffShNeedle(), nextBlock(), and stringBetween().
00016 { 00017 void *newPt = needLargeMem(size); 00018 memcpy(newPt, pt, size); 00019 return newPt; 00020 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* cloneString | ( | char * | s | ) |
Definition at line 31 of file common.c.
References cloneStringZ().
Referenced by allocNt4(), apacheAccessLogParse(), asParseColArraySpec(), asParseColDef(), asParseTableDef(), asParseText(), axtAffine2Level(), axtFromBlocks(), axtReadWithPos(), axtScoreSchemeReadLf(), blastFileNextGapped(), blastFileOpenVerify(), bundleIntoTargets(), cgiEncode(), cgiEncodeFull(), cgiFromFile(), cgiParseMultipart(), cgiVarSet(), chainReadChainLine(), chainSubsetOnQ(), chainToPsl(), checkTagIsInside(), cloneDnaSeq(), clumpToExactRange(), clumpToHspRange(), convertEpsToPdf(), dnaLoadNextFromStack(), dnaLoadOpen(), dnaLoadSingle(), doBlat(), doDetailLine(), emblRecord(), expandRelativePath(), faReadAllMixableInLf(), faReadMixedNext(), faReadNamedSeq(), findMultipleWordHits(), fofOpen(), formParseVars(), forwardMergeTwo(), gapCalcFromString(), getDirs(), getFileNameFromHdrSig(), getLineMB(), getMimeHeaderFieldVal(), getMimeHeaderMainVal(), getQueryInput(), getWormGeneExonDna(), gfClientFileArray(), gffFileNew(), gffHasGtfGroup(), gfIndexNibsAndTwoBits(), gfPcrGetRanges(), gfPcrInputLoad(), gfQuerySeqTrans(), gfQuerySeqTransTrans(), gfRangeLoad(), gfRangesBundle(), gfWebConfigRead(), hashVarLine(), hpfNext(), htmlCookieFileRead(), htmlExpandUrl(), htmlFormVarSet(), htmlHeaderRead(), htmlPageParse(), htmlPageParseNoHead(), htmlTagScan(), initialEntityHash(), lineFileAttach(), lineFileOnString(), lineFileParseHttpHeader(), loadHashT3Ranges(), mafFromAxt(), mafMayOpen(), mafNextWithPos(), mafSubsetE(), mafWrite(), main(), mergeContigs(), netHttpGetMultiple(), netUrlHead(), newDnaSeq(), nextSeqFromMem(), nibInfoNew(), nibInput(), nibStreamOpen(), nibTwoCacheNew(), oligoDg(), oligoTm(), outputFa(), parseAttribute(), parseCookie(), parseCookies(), parseDatabaseLines(), parseElement(), parseEntity(), parseFileSeq(), parseGtfEnd(), parseIdent(), parseMultiParts(), parseQueryLines(), parseSeqSpec(), pcrLocalStrand(), peelChains(), phhmTraceToAxt(), plProcNew(), pscmSetHint(), pslFromFakeFfAli(), pslGetCreateSql(), pslLoad(), pslNew(), pslShowAlignmentStranded(), pslShowAlignmentStranded2(), pslTblNew(), pslTrimToQueryRange(), pslTrimToTargetRange(), pslxFileOpen(), pslxFileOpenWithMetaConfig(), qaStatusOnPage(), qaStatusSoftError(), quotedPrintableDecode(), raFromString(), readPartHeaderMB(), repeatMaskOutLoad(), saveAxtBundle(), searchOneIndex(), seqClumpToRangeList(), shaNewNode(), slPairNew(), spacedColumnFromSample(), splitOffNumber(), sqlByteArrayToString(), sqlCharArrayToString(), sqlDoubleArrayToString(), sqlFloatArrayToString(), sqlLongLongArrayToString(), sqlShortArrayToString(), sqlSignedArrayToString(), sqlStringArrayToString(), sqlStringComma(), sqlStringDynamicArray(), sqlUbyteArrayToString(), sqlUnsignedArrayToString(), sqlUshortArrayToString(), stringToSlNames(), stripCommas(), subTextNew(), tabRowGuessFixedOffsets(), transIndexBothStrands(), translateSeqN(), trixParseHitList(), trixSearchWordResults(), twoBitFromDnaSeq(), twoBitFromFile(), twoBitIsRange(), twoBitOpen(), twoBitReadSeqFragExt(), twoBitSpecNew(), twoBitSpecNewFile(), vgOpenGif(), wormCdnaInfo(), wormGeneFirstOrfName(), wormInfoForGene(), xAliLoad(), xapNew(), xapParseAny(), xapStartTag(), xaReadNext(), xpNew(), and xStitch().
00033 { 00034 if (s == NULL) 00035 return NULL; 00036 else 00037 return cloneStringZ(s, strlen(s)); 00038 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* cloneStringZ | ( | char * | s, | |
| int | size | |||
| ) |
Definition at line 22 of file common.c.
References needMem().
Referenced by cloneString(), faReadNamedSeq(), formParseVars(), htmlExpandUrl(), htmlStatusParse(), mafFromAxt(), mafSubsetE(), newGdfGene(), outputFa(), parseFileSeq(), pcrLocalStrand(), qaStringBetween(), splitOffNonNumeric(), and xStitch().
00024 { 00025 char *d = needMem(size+1); 00026 memcpy(d, s, size); 00027 d[size] = 0; 00028 return d; 00029 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* containsStringNoCase | ( | char * | haystack, | |
| char * | needle | |||
| ) |
Definition at line 1828 of file common.c.
References strstrNoCase().
01829 { 01830 return strstrNoCase(haystack, needle); 01831 }
Here is the call graph for this function:

| int countChars | ( | char * | s, | |
| char | c | |||
| ) |
Definition at line 1127 of file common.c.
Referenced by expandRelativePath(), gfPcrMakePrimer(), isGtfGroup(), makeEscapedString(), makeQuotedString(), projectString(), and tabRowByChar().
01129 { 01130 char a; 01131 int count = 0; 01132 while ((a = *s++) != 0) 01133 if (a == c) 01134 ++count; 01135 return count; 01136 }
Here is the caller graph for this function:

| int countCharsN | ( | char * | s, | |
| char | c, | |||
| int | size | |||
| ) |
| int countLeadingChars | ( | char * | s, | |
| char | c | |||
| ) |
| int countSame | ( | char * | a, | |
| char * | b | |||
| ) |
Definition at line 1158 of file common.c.
Referenced by cmpSeqName().
01160 { 01161 char c; 01162 int i; 01163 int count = 0; 01164 for (i=0; ; ++i) 01165 { 01166 c = a[i]; 01167 if (b[i] != c) 01168 break; 01169 if (c == 0) 01170 break; 01171 ++count; 01172 } 01173 return count; 01174 }
Here is the caller graph for this function:

| int differentStringNullOk | ( | char * | a, | |
| char * | b | |||
| ) |
| int differentWord | ( | char * | s1, | |
| char * | s2 | |||
| ) |
Definition at line 839 of file common.c.
Referenced by gffFindGeneIgnoreCase(), gffReadGenes(), rbTreeCmpWord(), stringArrayIx(), and warnAboutDupes().
00843 { 00844 char c1, c2; 00845 for (;;) 00846 { 00847 c1 = toupper(*s1++); 00848 c2 = toupper(*s2++); 00849 if (c1 != c2) /* Takes care of end of string in one but not the other too */ 00850 return c2-c1; 00851 if (c1 == 0) /* Take care of end of string in both. */ 00852 return 0; 00853 } 00854 }
Here is the caller graph for this function:

| static int doubleCmp | ( | const void * | va, | |
| const void * | vb | |||
| ) | [static] |
Definition at line 421 of file common.c.
Referenced by doubleSort().
00423 { 00424 const double *a = va; 00425 const double *b = vb; 00426 double diff = *a - *b; 00427 if (diff < 0) 00428 return -1; 00429 else if (diff > 0) 00430 return 1; 00431 else 00432 return 0; 00433 }
Here is the caller graph for this function:

| double doubleMedian | ( | int | count, | |
| double * | array | |||
| ) |
Definition at line 442 of file common.c.
References doubleSort().
Referenced by slDoubleMedian().
00445 { 00446 double median; 00447 doubleSort(count, array); 00448 if ((count&1) == 1) 00449 median = array[count>>1]; 00450 else 00451 { 00452 count >>= 1; 00453 median = (array[count] + array[count-1]) * 0.5; 00454 } 00455 return median; 00456 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void doubleSort | ( | int | count, | |
| double * | array | |||
| ) |
Definition at line 435 of file common.c.
References doubleCmp().
Referenced by doubleMedian().
00437 { 00438 if (count > 1) 00439 qsort(array, count, sizeof(array[0]), doubleCmp); 00440 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* emptyForNull | ( | char * | s | ) |
| boolean endsWith | ( | char * | string, | |
| char * | end | |||
| ) |
Definition at line 937 of file common.c.
References FALSE, and sameString.
Referenced by getDecompressor(), netLineFileMayOpen(), netLineFileMayOpenCatchError(), nibIsFile(), nibIsRange(), sendFtpCommand(), setupWss(), textOutInit(), twoBitIsFile(), and twoBitSpecNew().
00939 { 00940 int sLen, eLen, offset; 00941 sLen = strlen(string); 00942 eLen = strlen(end); 00943 offset = sLen - eLen; 00944 if (offset < 0) 00945 return FALSE; 00946 return sameString(string+offset, end); 00947 }
Here is the caller graph for this function:

| void eraseTrailingSpaces | ( | char * | s | ) |
Definition at line 1311 of file common.c.
Referenced by htmlTagScan(), and trimSpaces().
01313 { 01314 int len = strlen(s); 01315 int i; 01316 char c; 01317 01318 for (i=len-1; i>=0; --i) 01319 { 01320 c = s[i]; 01321 if (isspace(c)) 01322 s[i] = 0; 01323 else 01324 break; 01325 } 01326 }
Here is the caller graph for this function:

| void eraseWhiteSpace | ( | char * | s | ) |
Definition at line 1329 of file common.c.
Referenced by base64Validate(), and phyloParseString().
01330 { 01331 char *in, *out; 01332 char c; 01333 01334 in = out = s; 01335 for (;;) 01336 { 01337 c = *in++; 01338 if (c == 0) 01339 break; 01340 if (!isspace(c)) 01341 *out++ = c; 01342 } 01343 *out++ = 0; 01344 }
Here is the caller graph for this function:

| boolean fastReadString | ( | FILE * | f, | |
| char | buf[256] | |||
| ) |
Definition at line 1570 of file common.c.
References FALSE, mustRead(), readOne, TRUE, and UBYTE.
Referenced by twoBitOpen().
01573 { 01574 UBYTE bLen; 01575 int len; 01576 if (!readOne(f, bLen)) 01577 return FALSE; 01578 if ((len = bLen)> 0) 01579 mustRead(f, buf, len); 01580 buf[len] = 0; 01581 return TRUE; 01582 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean fileExists | ( | char * | fileName | ) |
Definition at line 1814 of file common.c.
References fileSize(), sameString, and TRUE.
Referenced by htmlIncludeFile(), htmlPageGet(), mysqlHost(), and rTempName().
01817 { 01818 /* To make piping easier stdin and stdout always exist. */ 01819 if (sameString(fileName, "stdin")) return TRUE; 01820 if (sameString(fileName, "stdout")) return TRUE; 01821 01822 return fileSize(fileName) != -1; 01823 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* firstWordInFile | ( | char * | fileName, | |
| char * | wordBuf, | |||
| int | wordBufSize | |||
| ) |
Definition at line 1691 of file common.c.
References mustOpen(), and trimSpaces().
Referenced by getDirs(), and mysqlHost().
01693 { 01694 FILE *f = mustOpen(fileName, "r"); 01695 fgets(wordBuf, wordBufSize, f); 01696 fclose(f); 01697 return trimSpaces(wordBuf); 01698 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* firstWordInLine | ( | char * | line | ) |
Definition at line 1381 of file common.c.
References skipLeadingSpaces(), and skipToSpaces().
Referenced by faMixedSpeedReadNext().
01384 { 01385 char *e; 01386 line = skipLeadingSpaces(line); 01387 if ((e = skipToSpaces(line)) != NULL) 01388 *e = 0; 01389 return line; 01390 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void gentleFree | ( | void * | pt | ) |
Definition at line 834 of file common.c.
References freeMem().
Referenced by gif_compress_data().
00835 { 00836 if (pt != NULL) freeMem((char*)pt); 00837 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean hasWhiteSpace | ( | char * | s | ) |
| int intAbs | ( | int | a | ) |
Definition at line 1714 of file common.c.
Referenced by cdaCoalesceOne().
Here is the caller graph for this function:

| static int intCmp | ( | const void * | va, | |
| const void * | vb | |||
| ) | [static] |
Definition at line 497 of file common.c.
Referenced by intSort().
00499 { 00500 const int *a = va; 00501 const int *b = vb; 00502 int diff = *a - *b; 00503 if (diff < 0) 00504 return -1; 00505 else if (diff > 0) 00506 return 1; 00507 else 00508 return 0; 00509 }
Here is the caller graph for this function:

| int intMedian | ( | int | count, | |
| int * | array | |||
| ) |
Definition at line 518 of file common.c.
References intSort().
00521 { 00522 int median; 00523 intSort(count, array); 00524 if ((count&1) == 1) 00525 median = array[count>>1]; 00526 else 00527 { 00528 count >>= 1; 00529 median = (array[count] + array[count-1]) * 0.5; 00530 } 00531 return median; 00532 }
Here is the call graph for this function:

| void intSort | ( | int | count, | |
| int * | array | |||
| ) |
Definition at line 511 of file common.c.
References intCmp().
Referenced by intMedian().
00513 { 00514 if (count > 1) 00515 qsort(array, count, sizeof(array[0]), intCmp); 00516 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char lastChar | ( | char * | s | ) |
Definition at line 949 of file common.c.
Referenced by htmlExpandUrl(), quotedPCollapse(), and quotedPrintableEncode().
Here is the caller graph for this function:

| char* lastWordInLine | ( | char * | line | ) |
Definition at line 1392 of file common.c.
References skipLeadingSpaces(), and skipToSpaces().
01396 { 01397 char *s = line; 01398 char *word = NULL, *wordEnd = NULL; 01399 for (;;) 01400 { 01401 s = skipLeadingSpaces(s); 01402 if (s == NULL || s[0] == 0) 01403 break; 01404 word = s; 01405 s = wordEnd = skipToSpaces(s); 01406 if (s == NULL) 01407 break; 01408 } 01409 if (wordEnd != NULL) 01410 *wordEnd = 0; 01411 return word; 01412 }
Here is the call graph for this function:

| void makeDirs | ( | char * | path | ) |
Definition at line 2014 of file common.c.
References makeDir(), and PATH_LEN.
02016 { 02017 char pathBuf[PATH_LEN]; 02018 char* next = pathBuf; 02019 02020 strcpy(pathBuf, path); 02021 if (*next == '/') 02022 next++; 02023 02024 while((*next != '\0') 02025 && (next = strchr(next, '/')) != NULL) 02026 { 02027 *next = '\0'; 02028 makeDir(pathBuf); 02029 *next = '/'; 02030 next++; 02031 } 02032 makeDir(pathBuf); 02033 }
Here is the call graph for this function:

| char* memMatch | ( | char * | needle, | |
| int | nLen, | |||
| char * | haystack, | |||
| int | hLen | |||
| ) |
Definition at line 957 of file common.c.
Referenced by countOccurrences(), getChunkMB(), jiggleSmallExons(), pcrLocalStrand(), and setEopMB().
00960 { 00961 char c = *needle++; 00962 nLen -= 1; 00963 hLen -= nLen; 00964 while (--hLen >= 0) 00965 { 00966 if (*haystack++ == c && memcmp(needle, haystack, nLen) == 0) 00967 { 00968 return haystack-1; 00969 } 00970 } 00971 return NULL; 00972 }
Here is the caller graph for this function:

| FILE* mustOpen | ( | char * | fileName, | |
| char * | mode | |||
| ) |
Definition at line 1482 of file common.c.
References errAbort(), errno, and sameString.
Referenced by appendMimeVar(), blat(), cdaCreate(), cdaOpenVerify(), codonLoadBias(), dnaMotifToLogoPs(), dnaMotifToLogoPsW(), doBlat(), doDetailLine(), elFromRec(), faWrite(), faWriteAll(), firstWordInFile(), flyCdnaSeq(), fofMake(), fofOpen(), fofRecToPos(), gfClient(), gfClientFileArray(), gfMakeOoc(), gfPcrOutputWriteAll(), hashHisto(), jpegSize(), logOpenFile(), mafWriteAll(), mgLoadGif(), mgSaveGif(), nibOutput(), nibStreamOpen(), nt4OpenVerify(), oocMaskCounts(), parseMultiParts(), pslWriteAll(), psOpen(), readInGulp(), saveNt4(), scanChromOffsetFile(), twoBitOpen(), verboseSetLogFile(), wormCacheSomeGdf(), wormCdaAlisInRange(), wormCdnaCache(), wormGeneForOrf(), wormGeneRange(), wormInfoForGene(), wormSearchAllCdna(), writeGulp(), xaIxOpenVerify(), xaOpenVerify(), xapOpen(), xapParseFile(), xenAlignBig(), xenAlignWorm(), and xStitch().
01484 { 01485 FILE *f; 01486 01487 if (sameString(fileName, "stdin")) 01488 return stdin; 01489 if (sameString(fileName, "stdout")) 01490 return stdout; 01491 if ((f = fopen(fileName, mode)) == NULL) 01492 { 01493 char *modeName = ""; 01494 if (mode) 01495 { 01496 if (mode[0] == 'r') 01497 modeName = " to read"; 01498 else if (mode[0] == 'w') 01499 modeName = " to write"; 01500 else if (mode[0] == 'a') 01501 modeName = " to append"; 01502 } 01503 errAbort("Can't open %s%s: %s", fileName, modeName, strerror(errno)); 01504 } 01505 return f; 01506 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void mustRead | ( | FILE * | file, | |
| void * | buf, | |||
| size_t | size | |||
| ) |
Definition at line 1518 of file common.c.
References errAbort().
Referenced by cdaLoadString(), fastReadString(), fofBatchFind(), fofFetch(), fofFetchString(), fofFindFirst(), fofOpen(), fofSearch(), gdfReadOneGene(), loadNt4(), nt4LoadPart(), readBits64(), readInGulp(), readString(), scanChromOffsetFile(), twoBitFromFile(), twoBitReadSeqFragExt(), and xaReadNext().
01520 { 01521 if (size != 0 && fread(buf, size, 1, file) != 1) 01522 errAbort("Error reading %lld bytes: %s", (long long)size, strerror(ferror(file))); 01523 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* mustReadString | ( | FILE * | f | ) |
Definition at line 1560 of file common.c.
References errAbort(), and readString().
01562 { 01563 char *s = readString(f); 01564 if (s == NULL) 01565 errAbort("Couldn't read string"); 01566 return s; 01567 }
Here is the call graph for this function:

| void mustWrite | ( | FILE * | file, | |
| void * | buf, | |||
| size_t | size | |||
| ) |
Definition at line 1508 of file common.c.
References errAbort().
Referenced by axtWrite(), bandExt(), cdaWriteString(), dumpNearCrossover(), fofMake(), kvtWriteAll(), makeIndex(), parseMultiParts(), savePslx(), twoBitWriteOne(), writeBits64(), writeContig(), writeGulp(), writeSeqWithBreaks(), writeString(), and xenShowAli().
01510 { 01511 if (size != 0 && fwrite(buf, size, 1, file) != 1) 01512 { 01513 errAbort("Error writing %lld bytes: %s\n", (long long)size, strerror(ferror(file))); 01514 } 01515 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* naForEmpty | ( | char * | s | ) |
| char* naForNull | ( | char * | s | ) |
Definition at line 1957 of file common.c.
Referenced by htmlFormVarPrint().
01959 { 01960 if (s == NULL) 01961 s = naStr; 01962 return s; 01963 }
Here is the caller graph for this function:

| struct slName* newSlName | ( | char * | name | ) | [read] |
Definition at line 535 of file common.c.
References AllocVar, and needMem().
Referenced by cgiStringList(), listDir(), parseMultiOption(), readAllLines(), slNameStore(), wormGeneToOrfNames(), and xStitch().
00537 { 00538 struct slName *sn; 00539 if (name != NULL) 00540 { 00541 int len = strlen(name); 00542 sn = needMem(sizeof(*sn)+len); 00543 strcpy(sn->name, name); 00544 return sn; 00545 } 00546 else 00547 { 00548 AllocVar(sn); 00549 } 00550 return sn; 00551 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* nextTabWord | ( | char ** | pLine | ) |
Definition at line 1431 of file common.c.
01433 { 01434 char *s = *pLine; 01435 char *e; 01436 if (s == NULL || *s == '\n' || *s == 0) 01437 { 01438 *pLine = NULL; 01439 return NULL; 01440 } 01441 e = strchr(s, '\t'); 01442 if (e == NULL) 01443 { 01444 e = strchr(s, '\n'); 01445 if (e != NULL) 01446 *e = 0; 01447 *pLine = NULL; 01448 } 01449 else 01450 { 01451 *e++ = 0; 01452 *pLine = e; 01453 } 01454 return s; 01455 }
| char* nextWord | ( | char ** | pLine | ) |
Definition at line 1414 of file common.c.
References skipLeadingSpaces(), and skipToSpaces().
Referenced by apacheAccessLogParse(), checkTagIsInside(), emblLineGroup(), findTileSize(), getHitsFromServer(), gfPcrGetRanges(), gfWebConfigRead(), hashWordsInFile(), hpfNext(), htmlCookieFileRead(), htmlHeaderRead(), lineFileParseHttpHeader(), lineFileSlurpHttpBody(), mafMayOpen(), mafNextWithPos(), needNextWord(), netSkipHttpHeaderLines(), netSkipHttpHeaderLinesCatch(), netUrlHead(), nextQuotedWord(), parseGtfEnd(), raFoldInOneRetName(), raFromString(), raNextRecord(), readTaggedNumLine(), spacedColumnFromSample(), startServer(), trixParseHitList(), and trixSearchWordResults().
01417 { 01418 char *s = *pLine, *e; 01419 if (s == NULL || s[0] == 0) 01420 return NULL; 01421 s = skipLeadingSpaces(s); 01422 if (s[0] == 0) 01423 return NULL; 01424 e = skipToSpaces(s); 01425 if (e != NULL) 01426 *e++ = 0; 01427 *pLine = e; 01428 return s; 01429 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* nullIfAllSpace | ( | char * | s | ) |
Definition at line 1981 of file common.c.
References skipLeadingSpaces().
01983 { 01984 s = skipLeadingSpaces(s); 01985 if (s != NULL) 01986 if (s[0] == 0) 01987 s = NULL; 01988 return s; 01989 }
Here is the call graph for this function:

| int positiveRangeIntersection | ( | int | start1, | |
| int | end1, | |||
| int | start2, | |||
| int | end2 | |||
| ) |
Definition at line 1729 of file common.c.
References rangeIntersection().
Referenced by addOverlap().
01732 { 01733 int ret = rangeIntersection(start1,end1,start2,end2); 01734 if (ret < 0) 01735 ret = 0; 01736 return ret; 01737 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ptArrayIx | ( | void * | pt, | |
| void * | array, | |||
| int | arraySize | |||
| ) |
Definition at line 1467 of file common.c.
Referenced by aliLines().
01469 { 01470 int i; 01471 void **a = array; 01472 for (i=0; i<arraySize; ++i) 01473 { 01474 if (pt == a[i]) 01475 return i; 01476 } 01477 return -1; 01478 }
Here is the caller graph for this function:

| int rangeIntersection | ( | int | start1, | |
| int | end1, | |||
| int | start2, | |||
| int | end2 | |||
| ) |
Definition at line 1720 of file common.c.
Referenced by binKeeperAnyOverlap(), binKeeperFind(), binKeeperFindLowest(), binKeeperReplaceVal(), positiveRangeIntersection(), pslTrimToQueryRange(), pslTrimToTargetRange(), and rBoxJoin().
Here is the caller graph for this function:

| bits64 readBits64 | ( | FILE * | f | ) |
Definition at line 1597 of file common.c.
References bits64, mustRead(), and UBYTE.
01599 { 01600 int i; 01601 UBYTE buf[8]; 01602 bits64 x = 0; 01603 mustRead(f, buf, 8); 01604 for (i=0; i<8; ++i) 01605 { 01606 x <<= 8; 01607 x |= buf[i]; 01608 } 01609 return x; 01610 }
Here is the call graph for this function:

| char* readLine | ( | FILE * | fh | ) |
Definition at line 1779 of file common.c.
References errAbort(), freeMem(), and needMem().
01781 { 01782 int bufCapacity = 256; 01783 int bufSize = 0; 01784 char* buf = needMem(bufCapacity); 01785 int ch; 01786 01787 /* loop until EOF of EOLN */ 01788 while (((ch = getc(fh)) != EOF) && (ch != '\n')) 01789 { 01790 /* expand if almost full, always keep one extra char for 01791 * zero termination */ 01792 if (bufSize >= bufCapacity-2) 01793 { 01794 bufCapacity *= 2; 01795 buf = realloc(buf, bufCapacity); 01796 if (buf == NULL) 01797 { 01798 errAbort("Out of memory in readline - request size %d bytes", bufCapacity); 01799 } 01800 } 01801 buf[bufSize++] = ch; 01802 } 01803 01804 /* only return EOF if no data was read */ 01805 if ((ch == EOF) && (bufSize == 0)) 01806 { 01807 freeMem(buf); 01808 return NULL; 01809 } 01810 buf[bufSize] = '\0'; 01811 return buf; 01812 }
Here is the call graph for this function:

| char* readString | ( | FILE * | f | ) |
Definition at line 1543 of file common.c.
References mustRead(), needMem(), readOne, and UBYTE.
Referenced by mustReadString().
01546 { 01547 UBYTE bLen; 01548 int len; 01549 char *s; 01550 01551 if (!readOne(f, bLen)) 01552 return NULL; 01553 len = bLen; 01554 s = needMem(len+1); 01555 if (len > 0) 01556 mustRead(f, s, len); 01557 return s; 01558 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void refAdd | ( | struct slRef ** | pRefList, | |
| void * | val | |||
| ) |
Definition at line 725 of file common.c.
References AllocVar, slAddHead, and slRef::val.
Referenced by addRef(), findOrMakeVar(), loadHashT3Ranges(), and refAddUnique().
00727 { 00728 struct slRef *ref; 00729 AllocVar(ref); 00730 ref->val = val; 00731 slAddHead(pRefList, ref); 00732 }
Here is the caller graph for this function:

| void refAddUnique | ( | struct slRef ** | pRefList, | |
| void * | val | |||
| ) |
| struct slRef* refListFromSlList | ( | void * | list | ) | [read] |
Definition at line 743 of file common.c.
References slList::next, slAddHead, slRefNew(), and slReverse().
00745 { 00746 struct slList *el; 00747 struct slRef *refList = NULL, *ref; 00748 for (el= list; el != NULL; el = el->next) 00749 { 00750 ref = slRefNew(el); 00751 slAddHead(&refList, ref); 00752 } 00753 slReverse(&refList); 00754 return refList; 00755 }
Here is the call graph for this function:

Definition at line 706 of file common.c.
References slRef::next, and slRef::val.
Referenced by refAddUnique().
00708 { 00709 struct slRef *ref; 00710 for (ref = refList; ref != NULL; ref = ref->next) 00711 if (ref->val == val) 00712 return ref; 00713 return NULL; 00714 }
Here is the caller graph for this function:

| void removeReturns | ( | char * | dest, | |
| char * | src | |||
| ) |
Definition at line 1751 of file common.c.
01755 { 01756 int i = 0; 01757 int j = 0; 01758 01759 /* until the end of the string */ 01760 for (;;) 01761 { 01762 /* skip the returns */ 01763 while(src[j] == '\r') 01764 j++; 01765 01766 /* copy the characters */ 01767 dest[i] = src[j]; 01768 01769 /* check to see if done */ 01770 if(src[j] == '\0') 01771 break; 01772 01773 /* advance the counters */ 01774 i++; 01775 j++; 01776 } 01777 }
| char* replaceChars | ( | char * | string, | |
| char * | old, | |||
| char * | new | |||
| ) |
Definition at line 1018 of file common.c.
References max, and needMem().
Referenced by netParseUrl().
01024 { 01025 int numTimes = 0; 01026 int oldLen = strlen(old); 01027 int newLen = strlen(new); 01028 int strLen = 0; 01029 char *result = NULL; 01030 char *ptr = strstr(string, old); 01031 char *resultPtr = NULL; 01032 01033 while(NULL != ptr) 01034 { 01035 numTimes++; 01036 ptr += oldLen; 01037 ptr = strstr(ptr, old); 01038 } 01039 strLen = max(strlen(string) + (numTimes * (newLen - oldLen)), strlen(string)); 01040 result = needMem(strLen + 1); 01041 01042 ptr = strstr(string, old); 01043 resultPtr = result; 01044 while(NULL != ptr) 01045 { 01046 strLen = ptr - string; 01047 strcpy(resultPtr, string); 01048 string = ptr + oldLen; 01049 01050 resultPtr += strLen; 01051 strcpy(resultPtr, new); 01052 resultPtr += newLen; 01053 ptr = strstr(string, old); 01054 } 01055 01056 strcpy(resultPtr, string); 01057 return result; 01058 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void reverseBytes | ( | char * | bytes, | |
| long | length | |||
| ) |
Definition at line 57 of file common.c.
Referenced by axtAffine2Level(), bandExt(), mafFlipStrand(), reverseComplement(), and reverseFold().
00058 { 00059 long halfLen = (length>>1); 00060 char *end = bytes+length; 00061 char c; 00062 while (--halfLen >= 0) 00063 { 00064 c = *bytes; 00065 *bytes++ = *--end; 00066 *end = c; 00067 } 00068 }
Here is the caller graph for this function:

| void reverseDoubles | ( | double * | a, | |
| int | length | |||
| ) |
| void reverseInts | ( | int * | a, | |
| int | length | |||
| ) |
Definition at line 70 of file common.c.
Referenced by pslShowAlignmentStranded2().
00072 { 00073 int halfLen = (length>>1); 00074 int *end = a+length; 00075 int c; 00076 while (--halfLen >= 0) 00077 { 00078 c = *a; 00079 *a++ = *--end; 00080 *end = c; 00081 } 00082 }
Here is the caller graph for this function:

| void reverseStrings | ( | char ** | a, | |
| int | length | |||
| ) |
| void reverseUnsigned | ( | unsigned * | a, | |
| int | length | |||
| ) |
Definition at line 84 of file common.c.
Referenced by pslRc(), pslRcBoth(), and swapRCBlocks().
00086 { 00087 int halfLen = (length>>1); 00088 unsigned *end = a+length; 00089 unsigned c; 00090 while (--halfLen >= 0) 00091 { 00092 c = *a; 00093 *a++ = *--end; 00094 *end = c; 00095 } 00096 }
Here is the caller graph for this function:

| int roundingScale | ( | int | a, | |
| int | p, | |||
| int | q | |||
| ) |
Definition at line 1700 of file common.c.
References round.
Referenced by cdaAliFromFfAli(), cdaCoalesceOne(), cdaShowAlignmentTrack(), and savePslx().
01702 { 01703 if (a > 100000 || p > 100000) 01704 { 01705 double x = a; 01706 x *= p; 01707 x /= q; 01708 return round(x); 01709 } 01710 else 01711 return (a*p + q/2)/q; 01712 }
Here is the caller graph for this function:

| char* rStringIn | ( | char * | needle, | |
| char * | haystack | |||
| ) |
| void safecat | ( | char * | buf, | |
| size_t | bufSize, | |||
| const char * | src | |||
| ) |
Definition at line 1930 of file common.c.
References errAbort().
01932 { 01933 size_t blen = strlen(buf); 01934 size_t slen = strlen(src); 01935 if (blen+slen > bufSize-1) 01936 errAbort("buffer overflow, size %lld, new string size: %lld", (long long)bufSize, (long long)(blen+slen)); 01937 strcat(buf, src); 01938 }
Here is the call graph for this function:

| void safecpy | ( | char * | buf, | |
| size_t | bufSize, | |||
| const char * | src | |||
| ) |
Definition at line 1908 of file common.c.
References errAbort().
01910 { 01911 size_t slen = strlen(src); 01912 if (slen > bufSize-1) 01913 errAbort("buffer overflow, size %lld, string size: %lld", (long long)bufSize, (long long)slen); 01914 strcpy(buf, src); 01915 }
Here is the call graph for this function:

| int safef | ( | char * | buffer, | |
| int | bufSize, | |||
| char * | format, | |||
| ... | ||||
| ) |
Definition at line 1896 of file common.c.
References vasafef().
Referenced by cgiBooleanDefined(), cgiEncode(), cgiEncodeFull(), cgiFromCommandLine(), cgiMakeCheckBoxWithMsg(), cgiMakeClearButton(), cgiMakeHiddenBoolean(), cgiParseMultipart(), chainLookup(), chainReadUsedSwapLf(), checkNest(), checkTagIsInside(), convertEpsToPdf(), envUpdate(), evalToDouble(), fofOpen(), getFileNameFromHdrSig(), getTargetName(), gfiExpandAndLoadCached(), gfIndexNibsAndTwoBits(), gfIndexTransNibsAndTwoBits(), gfPcrGetRanges(), gifLabelVerticalText(), hashLookupUpperCase(), htmlFormCgiVars(), htmlIncludeWebFile(), mafFromAxt(), mkdirTrashDirectory(), ncbiPrintE(), netGetOpenFtp(), netHttpConnect(), netHttpGet(), nibInfoFromCache(), nibLdPartMasked(), nibOpenVerify(), nibTwoLoadOne(), parseMultiParts(), pcrQuery(), pslGetCreateSql(), pslTransMap(), readSeqFrag(), rTempName(), semiUniqName(), trixOpen(), and twoBitReadSeqFragExt().
01899 { 01900 int sz; 01901 va_list args; 01902 va_start(args, format); 01903 sz = vasafef(buffer, bufSize, format, args); 01904 va_end(args); 01905 return sz; 01906 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void safencat | ( | char * | buf, | |
| size_t | bufSize, | |||
| const char * | src, | |||
| size_t | n | |||
| ) |
Definition at line 1940 of file common.c.
References errAbort().
01942 { 01943 size_t blen = strlen(buf); 01944 if (blen+n > bufSize-1) 01945 errAbort("buffer overflow, size %lld, new string size: %lld", (long long)bufSize, (long long)(blen+n)); 01946 size_t slen = strlen(src); 01947 if (slen > n) 01948 slen = n; 01949 strncat(buf, src, n); 01950 buf[blen+slen] = '\0'; 01951 }
Here is the call graph for this function:

| void safencpy | ( | char * | buf, | |
| size_t | bufSize, | |||
| const char * | src, | |||
| size_t | n | |||
| ) |
Definition at line 1917 of file common.c.
References errAbort().
01920 { 01921 if (n > bufSize-1) 01922 errAbort("buffer overflow, size %lld, substring size: %lld", (long long)bufSize, (long long)n); 01923 size_t slen = strlen(src); 01924 if (slen > n) 01925 slen = n; 01926 strncpy(buf, src, n); 01927 buf[slen] = '\0'; 01928 }
Here is the call graph for this function:

| char* skipLeadingSpaces | ( | char * | s | ) |
Definition at line 1278 of file common.c.
Referenced by axtScoreSchemeFromProteinText(), bfSkipBlankLines(), cgiInt(), cgiOptionalInt(), eatComment(), emblLineGroup(), faMixedSpeedReadNext(), firstWordInLine(), hashVarLine(), hpfNext(), htmlCookieFileRead(), htmlHeaderRead(), htmlStatusParse(), htmlTagScan(), lastWordInLine(), lineFileNextReal(), netSkipHttpHeaderLines(), netSkipHttpHeaderLinesCatch(), netUrlHead(), nextQuotedWord(), nextSeqFromMem(), nextWord(), nullIfAllSpace(), parseAttribute(), parseCookie(), parseEntity(), parseGtfEnd(), parseQueryLines(), raFoldInOneRetName(), raFromString(), raNextRecord(), stringToSlNames(), tabRowGuessFixedOffsets(), tokenizerNext(), and trimSpaces().
01280 { 01281 char c; 01282 if (s == NULL) return NULL; 01283 for (;;) 01284 { 01285 c = *s; 01286 if (!isspace(c)) 01287 return s; 01288 ++s; 01289 } 01290 }
Here is the caller graph for this function:

| char* skipNumeric | ( | char * | s | ) |
| char* skipToNumeric | ( | char * | s | ) |
Definition at line 2043 of file common.c.
Referenced by splitOffNonNumeric(), and splitOffNumber().
Here is the caller graph for this function:

| char* skipToSpaces | ( | char * | s | ) |
Definition at line 1293 of file common.c.
Referenced by firstWordInLine(), hashVarLine(), htmlStatusParse(), lastWordInLine(), nextSeqFromMem(), nextWord(), stringToSlNames(), and tabRowGuessFixedOffsets().
01294 { 01295 char c; 01296 if (s == NULL) 01297 return NULL; 01298 for (;;) 01299 { 01300 c = *s; 01301 if (c == 0) 01302 return NULL; 01303 if (isspace(c)) 01304 return s; 01305 ++s; 01306 } 01307 }
Here is the caller graph for this function:

| void slAddTail | ( | void * | listPt, | |
| void * | node | |||
| ) |
Definition at line 200 of file common.c.
References slList::next.
Referenced by asParseTokens(), dgFindPath(), gffReadGenes(), gfRangesBundle(), gfWebConfigRead(), hpfNext(), htmlFormVarAddValue(), htmlHeaderRead(), htmlTagScan(), loadHashT3Ranges(), parseAttribute(), parseMultiOption(), pipelineNew(), slNameAddTail(), spaceSaverAddOverflow(), wormGeneToOrfNames(), and wormGetSomeGdfGeneList().
00201 { 00202 struct slList **ppt = (struct slList **)listPt; 00203 struct slList *n = (struct slList *)node; 00204 00205 while (*ppt != NULL) 00206 { 00207 ppt = &((*ppt)->next); 00208 } 00209 n->next = NULL; 00210 *ppt = n; 00211 }
Here is the caller graph for this function:

| void* slCat | ( | void * | va, | |
| void * | vb | |||
| ) |
Definition at line 265 of file common.c.
References slList::next.
Referenced by addToBigBundleList(), boxLump(), clumpHits(), gfAlignTrans(), gfAlignTransTrans(), gfClientSeqList(), gfTransTransFindBundles(), mergeClusters(), and xenAlignWorm().
00267 : 00268 * struct slName *a = getNames("a"); 00269 * struct slName *b = getNames("b"); 00270 * struct slName *ab = slCat(a,b) 00271 */ 00272 { 00273 struct slList *a = va; 00274 struct slList *b = vb; 00275 struct slList *end; 00276 if (a == NULL) 00277 return b; 00278 for (end = a; end->next != NULL; end = end->next) 00279 ; 00280 end->next = b; 00281 return a; 00282 }
Here is the caller graph for this function:

| int slCount | ( | void * | list | ) |
List managing routines.
Definition at line 144 of file common.c.
References slList::next.
Referenced by bigBlat(), blat(), boxLump(), chainToPsl(), dlCount(), dnaSeqHash(), dumpBuns(), fofMake(), gffDupeGeneAndSurrounds(), gffPrintInfo(), gfHitSortDiagonal(), gfLargeIndexSeq(), gfQuerySeqTrans(), gfQuerySeqTransTrans(), gfSmallIndexSeq(), hpfNext(), kdTreeMake(), mafColMinMaxScore(), makeIndex(), phhmTraceToAxt(), rBoxJoin(), shuffleList(), slDoubleMedian(), slSort(), spacedColumnFromSizeCommaList(), tabRowByFixedOffsets(), twoBitWriteHeader(), wuBlastOut(), and xenAlignWorm().
00145 { 00146 struct slList *pt = (struct slList *)list; 00147 int len = 0; 00148 00149 while (pt != NULL) 00150 { 00151 len += 1; 00152 pt = pt->next; 00153 } 00154 return len; 00155 }
Here is the caller graph for this function:

| int slDoubleCmp | ( | const void * | va, | |
| const void * | vb | |||
| ) |
Definition at line 467 of file common.c.
References slDouble::val.
00469 { 00470 const struct slDouble *a = *((struct slDouble **)va); 00471 const struct slDouble *b = *((struct slDouble **)vb); 00472 double diff = a->val - b->val; 00473 if (diff < 0) 00474 return -1; 00475 else if (diff > 0) 00476 return 1; 00477 else 00478 return 0; 00479 }
| double slDoubleMedian | ( | struct slDouble * | list | ) |
Definition at line 481 of file common.c.
References AllocArray, doubleMedian(), errAbort(), freeMem(), slDouble::next, and slCount().
00483 { 00484 int i,count = slCount(list); 00485 struct slDouble *el; 00486 double *array, median; 00487 if (count == 0) 00488 errAbort("Can't take median of empty list"); 00489 AllocArray(array,count); 00490 for (i=0, el=list; i<count; ++i, el=el->next) 00491 array[i] = el->val; 00492 median = doubleMedian(count, array); 00493 freeMem(array); 00494 return median; 00495 }
Here is the call graph for this function:

| struct slDouble* slDoubleNew | ( | double | x | ) | [read] |
| void* slElementFromIx | ( | void * | list, | |
| int | ix | |||
| ) |
| void slFreeList | ( | void * | listPt | ) |
Definition at line 305 of file common.c.
References freeMem(), and slList::next.
Referenced by axtAffine(), binKeeperFree(), boxClumpFree(), chainFree(), connectedComponents(), dgNodeFree(), doubleExp(), ffFreeAli(), gfAlignTrans(), gfAlignTransTrans(), gffFileFree(), gffGroupFree(), gfxPolyFree(), hashElFreeList(), hpfModelFree(), hpfNext(), htmlFormVarFree(), lmCleanup(), mergeAdd(), pcrClumps(), psOneColumn(), psPolyFree(), saveAliToPermanentMem(), spacedColumnFromSizeCommaList(), spaceSaverFree(), ssFindBundles(), ssStitch(), tabRowByFixedGuess(), targetHitsFree(), validateCgiUrls(), wormChromPartExonsUpper(), wormGdfGenesInRange(), wormGeneFirstOrfName(), wormGeneRange(), xenAlignBig(), xenAlignWorm(), and xStitch().
00307 { 00308 struct slList **ppt = (struct slList**)listPt; 00309 struct slList *next = *ppt; 00310 struct slList *el; 00311 00312 while (next != NULL) 00313 { 00314 el = next; 00315 next = el->next; 00316 freeMem((char*)el); 00317 } 00318 *ppt = NULL; 00319 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int slIntCmp | ( | const void * | va, | |
| const void * | vb | |||
| ) |
| int slIntCmpRev | ( | const void * | va, | |
| const void * | vb | |||
| ) |
| struct slInt* slIntNew | ( | int | x | ) | [read] |
| int slIxFromElement | ( | void * | list, | |
| void * | el | |||
| ) |
Definition at line 171 of file common.c.
References slList::next.
00173 { 00174 struct slList *pt; 00175 int ix = 0; 00176 00177 for (pt = list, ix=0; pt != NULL; pt = pt->next, ++ix) 00178 if (el == (void*)pt) 00179 return ix; 00180 return -1; 00181 }
| void* slLastEl | ( | void * | list | ) |
Definition at line 183 of file common.c.
References slList::next.
Referenced by chainCalcBounds().
00185 { 00186 struct slList *next, *el; 00187 if ((el = list) == NULL) 00188 return NULL; 00189 while ((next = el->next) != NULL) 00190 el = next; 00191 return el; 00192 }
Here is the caller graph for this function:

Definition at line 655 of file common.c.
References slName::name, slName::next, slAddHead, slNameNew, and slReverse().
00657 { 00658 struct slName *el, *newEl, *newList = NULL; 00659 for (el = list; el != NULL; el = el->next) 00660 { 00661 newEl = slNameNew(el->name); 00662 slAddHead(&newList, newEl); 00663 } 00664 slReverse(&newList); 00665 return newList; 00666 }
Here is the call graph for this function:

| int slNameCmp | ( | const void * | va, | |
| const void * | vb | |||
| ) |
Definition at line 575 of file common.c.
References slName::name.
Referenced by slNameSort().
00577 { 00578 const struct slName *a = *((struct slName **)va); 00579 const struct slName *b = *((struct slName **)vb); 00580 return strcmp(a->name, b->name); 00581 }
Here is the caller graph for this function:

| int slNameCmpCase | ( | const void * | va, | |
| const void * | vb | |||
| ) |
Definition at line 561 of file common.c.
References slName::name.
Referenced by slNameSortCase().
00563 { 00564 const struct slName *a = *((struct slName **)va); 00565 const struct slName *b = *((struct slName **)vb); 00566 return strcasecmp(a->name, b->name); 00567 }
Here is the caller graph for this function:

| void* slNameFind | ( | void * | list, | |
| char * | string | |||
| ) |
Definition at line 599 of file common.c.
References slName::name, slName::next, and sameWord.
00602 { 00603 struct slName *el; 00604 for (el = list; el != NULL; el = el->next) 00605 if (sameWord(string, el->name)) 00606 return el; 00607 return NULL; 00608 }
| int slNameFindIx | ( | struct slName * | list, | |
| char * | string | |||
| ) |
Definition at line 610 of file common.c.
References slName::name, slName::next, and sameString.
00614 { 00615 struct slName *el; 00616 int ix = 0; 00617 for (el = list; el != NULL; el = el->next, ix++) 00618 if (sameString(string, el->name)) 00619 return ix; 00620 return -1; 00621 }
| boolean slNameInList | ( | struct slName * | list, | |
| char * | string | |||
| ) |
Definition at line 589 of file common.c.
References FALSE, slName::name, slName::next, sameWord, and TRUE.
Referenced by kvtWriteAll().
00591 { 00592 struct slName *el; 00593 for (el = list; el != NULL; el = el->next) 00594 if (sameWord(string, el->name)) 00595 return TRUE; 00596 return FALSE; 00597 }
Here is the caller graph for this function:

| struct slName* slNameListFromString | ( | char * | s, | |
| char | delimiter | |||
| ) | [read] |
Definition at line 668 of file common.c.
References slAddHead, slNameNew, slNameNewN(), and slReverse().
00672 { 00673 char *e; 00674 struct slName *list = NULL, *el; 00675 while (s != NULL && s[0] != 0) 00676 { 00677 e = strchr(s, delimiter); 00678 if (e == NULL) 00679 el = slNameNew(s); 00680 else 00681 { 00682 el = slNameNewN(s, e-s); 00683 e += 1; 00684 } 00685 slAddHead(&list, el); 00686 s = e; 00687 } 00688 slReverse(&list); 00689 return list; 00690 }
Here is the call graph for this function:

| struct slName* slNameLoadReal | ( | char * | fileName | ) | [read] |
Definition at line 692 of file common.c.
References lineFileClose(), lineFileNextReal(), lineFileOpen(), slNameNew, slReverse(), slSafeAddHead(), and TRUE.
00695 { 00696 struct slName *lines = NULL; 00697 char *line; 00698 struct lineFile *lf = lineFileOpen(fileName, TRUE); 00699 while (lineFileNextReal(lf, &line)) 00700 slSafeAddHead(&lines, slNameNew(line)); 00701 lineFileClose(&lf); 00702 slReverse(&lines); 00703 return lines; 00704 }
Here is the call graph for this function:

| struct slName* slNameNewN | ( | char * | name, | |
| int | size | |||
| ) | [read] |
Definition at line 553 of file common.c.
References needMem().
Referenced by charSepToSlNames(), and slNameListFromString().
00555 { 00556 struct slName *sn = needMem(sizeof(*sn) + size); 00557 memcpy(sn->name, name, size); 00558 return sn; 00559 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void slNameSort | ( | struct slName ** | pList | ) |
| void slNameSortCase | ( | struct slName ** | pList | ) |
Definition at line 569 of file common.c.
References slNameCmpCase(), and slSort().
00571 { 00572 slSort(pList, slNameCmpCase); 00573 }
Here is the call graph for this function:

| char* slNameStore | ( | struct slName ** | pList, | |
| char * | string | |||
| ) |
Definition at line 623 of file common.c.
References slName::name, newSlName(), slName::next, sameString, and slAddHead.
00626 { 00627 struct slName *el; 00628 for (el = *pList; el != NULL; el = el->next) 00629 { 00630 if (sameString(string, el->name)) 00631 return el->name; 00632 } 00633 el = newSlName(string); 00634 slAddHead(pList, el); 00635 return el->name; 00636 }
Here is the call graph for this function:

| void slPairAdd | ( | struct slPair ** | pList, | |
| char * | name, | |||
| void * | val | |||
| ) |
Definition at line 814 of file common.c.
References slPair::name, slPair::next, and sameString.
Referenced by slPairFindVal().
00816 { 00817 struct slPair *el; 00818 for (el = list; el != NULL; el = el->next) 00819 if (sameString(name, el->name)) 00820 break; 00821 return el; 00822 }
Here is the caller graph for this function:

| void* slPairFindVal | ( | struct slPair * | list, | |
| char * | name | |||
| ) |
Definition at line 824 of file common.c.
References slPairFind(), and slPair::val.
00826 { 00827 struct slPair *el = slPairFind(list, name); 00828 if (el == NULL) 00829 return NULL; 00830 return el->val; 00831 }
Here is the call graph for this function:

| void slPairFree | ( | struct slPair ** | pEl | ) |
Definition at line 775 of file common.c.
References freeMem(), freez(), and slPair::name.
Referenced by slPairFreeList().
00777 { 00778 struct slPair *el = *pEl; 00779 if (el != NULL) 00780 { 00781 freeMem(el->name); 00782 freez(pEl); 00783 } 00784 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void slPairFreeList | ( | struct slPair ** | pList | ) |
Definition at line 786 of file common.c.
References slPair::next, and slPairFree().
Referenced by slPairFreeValsAndList().
00788 { 00789 struct slPair *el, *next; 00790 00791 for (el = *pList; el != NULL; el = next) 00792 { 00793 next = el->next; 00794 slPairFree(&el); 00795 } 00796 *pList = NULL; 00797 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void slPairFreeVals | ( | struct slPair * | list | ) |
Definition at line 799 of file common.c.
References freez(), slPair::next, and slPair::val.
Referenced by slPairFreeValsAndList().
00801 { 00802 struct slPair *el; 00803 for (el = list; el != NULL; el = el->next) 00804 freez(&el->val); 00805 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void slPairFreeValsAndList | ( | struct slPair ** | pList | ) |
Definition at line 807 of file common.c.
References slPairFreeList(), and slPairFreeVals().
00809 { 00810 slPairFreeVals(*pList); 00811 slPairFreeList(pList); 00812 }
Here is the call graph for this function:

| struct slPair* slPairNew | ( | char * | name, | |
| void * | val | |||
| ) | [read] |
Definition at line 758 of file common.c.
References AllocVar, cloneString(), slPair::name, and slPair::val.
Referenced by slPairAdd().
00760 { 00761 struct slPair *el; 00762 AllocVar(el); 00763 el->name = cloneString(name); 00764 el->val = val; 00765 return el; 00766 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void* slPopHead | ( | void * | vListPt | ) |
Definition at line 229 of file common.c.
References slList::next.
Referenced by slUniqify(), and twoBitSpecFree().
00231 { 00232 struct slList **listPt = (struct slList **)vListPt; 00233 struct slList *el = *listPt; 00234 if (el != NULL) 00235 { 00236 *listPt = el->next; 00237 el->next = NULL; 00238 } 00239 return el; 00240 }
Here is the caller graph for this function:

| void* slPopTail | ( | void * | vListPt | ) |
Definition at line 242 of file common.c.
References slList::next.
00244 { 00245 struct slList **listPt = (struct slList **)vListPt; 00246 struct slList *el = *listPt; 00247 if (el != NULL) 00248 { 00249 for (;;) 00250 { 00251 if (el->next == NULL) 00252 { 00253 *listPt = NULL; 00254 break; 00255 } 00256 listPt = &el->next; 00257 el = el->next; 00258 } 00259 } 00260 return el; 00261 }
| struct slRef* slRefNew | ( | void * | val | ) | [read] |
Definition at line 716 of file common.c.
References AllocVar, and slRef::val.
Referenced by refListFromSlList().
00718 { 00719 struct slRef *ref; 00720 AllocVar(ref); 00721 ref->val = val; 00722 return ref; 00723 }
Here is the caller graph for this function:

| boolean slRemoveEl | ( | void * | vpList, | |
| void * | vToRemove | |||
| ) |
Definition at line 371 of file common.c.
References FALSE, slList::next, slAddHead, slReverse(), and TRUE.
Referenced by cgiVarExclude(), hashRemove(), and mafMoveComponentToTop().
00372 : 00373 * slRemove(&list, el); 00374 * Returns TRUE if element in list. */ 00375 { 00376 struct slList **pList = vpList; 00377 struct slList *toRemove = vToRemove; 00378 struct slList *el, *next, *newList = NULL; 00379 boolean didRemove = FALSE; 00380 00381 for (el = *pList; el != NULL; el = next) 00382 { 00383 next = el->next; 00384 if (el != toRemove) 00385 { 00386 slAddHead(&newList, el); 00387 } 00388 else 00389 didRemove = TRUE; 00390 } 00391 slReverse(&newList); 00392 *pList = newList; 00393 return didRemove; 00394 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void slReverse | ( | void * | listPt | ) |
Definition at line 284 of file common.c.
References slList::next.
Referenced by aliLines(), asParseColSymSpec(), asParseTableDef(), blastFileNextGapped(), blastFileNextQuery(), blastFileReadAll(), cgiParseInputAbort(), cgiParseMultipart(), chainMergeAbutting(), chainReadBlocks(), chainSubsetOnQ(), chainSwap(), chainToAxt(), charSepToSlNames(), clumpHits(), clumpNear(), crudeAliFind(), dgConstrainedPriorityOrder(), dnaLoadAll(), dtdParse(), faReadAllMixableInLf(), faSeqListFromMemText(), faSeqListFromMemTextRaw(), fastMapClumpsToBundles(), ffAliSort(), findMultipleWordHits(), fixDirectionAndOffsets(), formParseVars(), getHitsFromServer(), gfAlignSomeClumps(), gfAlignTrans(), gfAlignTransTrans(), gfClumpsToBundles(), gffFileAdd(), gffGroupLines(), gfFindAlignAaTrans(), gfHitSortDiagonal(), gfPcrGetRanges(), gfPcrInputLoadAll(), gfPcrViaNet(), gfQuerySeq(), gfQuerySeqTrans(), gfQuerySeqTransTrans(), gfTransTransFindBundles(), htmlCookieFileRead(), htmlPageScanAttribute(), htmlTagScan(), kxTokenizeFancy(), mafNextWithPos(), mafReadAll(), mafSubsetE(), makeOffsetList(), mergeHits(), parseCookies(), parseElement(), parseMultiParts(), pslLoadAll(), rangeTreeAllOverlapping(), rangeTreeList(), rbTreeItems(), rbTreeItemsInRange(), readAllLines(), refListFromSlList(), removeNegativeBlocks(), saveAxtBundle(), scanChromOffsetFile(), seqClumpToRangeList(), seqListToTrans3List(), shuffleList(), slNameCloneList(), slNameListFromString(), slNameLoadReal(), slRemoveEl(), slSort(), slUniqify(), spacedColumnFromSample(), spacedColumnFromWidthArray(), spaceSaverFinish(), ssGraphMake(), ssStitch(), stringToSlNames(), tabRowByFixedOffsets(), tabRowByWhite(), tabRowGuessFixedOffsets(), targetClump(), trixParseHitList(), trixSearch(), twoBitFromFile(), twoBitLoadAll(), twoBitOpen(), twoBitSeqNames(), twoBitSpecNew(), twoBitSpecNewFile(), wormCdaAlisInRange(), wormGdfGenesInRange(), wormGetSomeGdfGeneList(), xAliLoadAll(), and xaRdRange().
00286 : 00287 * slReverse(&list); 00288 */ 00289 { 00290 struct slList **ppt = (struct slList **)listPt; 00291 struct slList *newList = NULL; 00292 struct slList *el, *next; 00293 00294 next = *ppt; 00295 while (next != NULL) 00296 { 00297 el = next; 00298 next = el->next; 00299 el->next = newList; 00300 newList = el; 00301 } 00302 *ppt = newList; 00303 }
Here is the caller graph for this function:

| void slSafeAddHead | ( | void * | listPt, | |
| void * | node | |||
| ) |
Definition at line 219 of file common.c.
References slList::next.
Referenced by asParseColSymSpec(), slNameLoadReal(), twoBitLoadAll(), twoBitSpecNew(), and twoBitSpecNewFile().
00220 { 00221 struct slList **ppt = (struct slList **)listPt; 00222 struct slList *n = (struct slList *)node; 00223 00224 n->next = *ppt; 00225 *ppt = n; 00226 }
Here is the caller graph for this function:

| void slSort | ( | void * | pList, | |
| int(*)(const void *elem1, const void *elem2) | compare | |||
| ) |
Definition at line 321 of file common.c.
References freeMem(), needLargeMem(), slList::next, slCount(), and slReverse().
00323 { 00324 struct slList **pL = (struct slList **)pList; 00325 struct slList *list = *pL; 00326 int count; 00327 count = slCount(list); 00328 if (count > 1) 00329 { 00330 struct slList *el; 00331 struct slList **array; 00332 int i; 00333 array = needLargeMem(count * sizeof(*array)); 00334 for (el = list, i=0; el != NULL; el = el->next, i++) 00335 array[i] = el; 00336 qsort(array, count, sizeof(array[0]), compare); 00337 list = NULL; 00338 for (i=0; i<count; ++i) 00339 { 00340 array[i]->next = list; 00341 list = array[i]; 00342 } 00343 freeMem(array); 00344 slReverse(&list); 00345 *pL = list; 00346 } 00347 }
Here is the call graph for this function:

| void slUniqify | ( | void * | pList, | |
| int(*)(const void *elem1, const void *elem2) | compare, | |||
| void(*)() | free | |||
| ) |
Definition at line 349 of file common.c.
References slAddHead, slPopHead(), slReverse(), and slSort().
00354 { 00355 struct slList **pSlList = (struct slList **)pList; 00356 struct slList *oldList = *pSlList; 00357 struct slList *newList = NULL, *el; 00358 00359 slSort(&oldList, compare); 00360 while ((el = slPopHead(&oldList)) != NULL) 00361 { 00362 if ((newList == NULL) || (compare(&newList, &el) != 0)) 00363 slAddHead(&newList, el); 00364 else if (free != NULL) 00365 free(el); 00366 } 00367 slReverse(&newList); 00368 *pSlList = newList; 00369 }
Here is the call graph for this function:

| void spaceOut | ( | FILE * | f, | |
| int | count | |||
| ) |
Definition at line 1357 of file common.c.
Referenced by axtPrintTraditional(), and rTreeDump().
Here is the caller graph for this function:

| char* splitOffNonNumeric | ( | char * | s | ) |
Definition at line 2051 of file common.c.
References cloneStringZ(), and skipToNumeric().
02053 { 02054 return cloneStringZ(s,skipToNumeric(s)-s); 02055 }
Here is the call graph for this function:

| char* splitOffNumber | ( | char * | db | ) |
Definition at line 2057 of file common.c.
References cloneString(), and skipToNumeric().
02059 { 02060 return cloneString(skipToNumeric(db)); 02061 }
Here is the call graph for this function:

| void starOut | ( | FILE * | f, | |
| int | count | |||
| ) |
| boolean startsWith | ( | char * | start, | |
| char * | string | |||
| ) |
Definition at line 875 of file common.c.
Referenced by aliLines(), bfSearchForLine(), blastFileNextGapped(), cgiParseMultipart(), codonLoadBias(), dtdParse(), emblLineGroup(), expandRelativePath(), getFileNameFromHdrSig(), getPostInput(), gffTnName(), gfPcrGetRanges(), gfQuerySeq(), gfQuerySeqTrans(), gfQuerySeqTransTrans(), hpfNext(), htmlExpandUrl(), htmlPageParse(), htmlPageValidateOrAbort(), initCgiInput(), lineFileParseHttpHeader(), lineFileSkipToLineStartingWith(), lineFileSlurpHttpBody(), mafMayFindCompPrefix(), mafMayFindCompSpecies(), mafMayOpen(), maskFromOut(), mgLoadGif(), netLineFileMayOpen(), netLineFileMayOpenCatchError(), netSkipHttpHeaderLines(), netSkipHttpHeaderLinesCatch(), netUrlHead(), netUrlOpen(), nextBlock(), nextBlockLine(), parseAnOption(), parseMultiParts(), parseSubTree(), pcrServer(), pslOutFormat(), pslxFileOpen(), pslxFileOpenWithMetaConfig(), qaCountBetween(), queryServer(), raNextRecord(), reasonablePrefix(), startServer(), stripString(), trixSearchWordResults(), and validateCgiUrl().
00877 { 00878 char c; 00879 int i; 00880 00881 for (i=0; ;i += 1) 00882 { 00883 if ((c = start[i]) == 0) 00884 return TRUE; 00885 if (string[i] != c) 00886 return FALSE; 00887 } 00888 }
Here is the caller graph for this function:

| boolean startsWithWord | ( | char * | firstWord, | |
| char * | line | |||
| ) |
| int stringArrayIx | ( | char * | string, | |
| char * | array[], | |||
| int | arraySize | |||
| ) |
Definition at line 1457 of file common.c.
References differentWord().
Referenced by gfOutputAny().
01459 { 01460 int i; 01461 for (i=0; i<arraySize; ++i) 01462 if (!differentWord(array[i], string)) 01463 return i; 01464 return -1; 01465 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* stringBetween | ( | char * | start, | |
| char * | end, | |||
| char * | haystack | |||
| ) |
Definition at line 916 of file common.c.
References cloneMem(), and stringIn.
00920 { 00921 char *pos, *p; 00922 int len; 00923 if ((p = stringIn(start, haystack)) != NULL) 00924 { 00925 pos = p + strlen(start); 00926 if ((p = stringIn(end, pos)) != NULL) 00927 { 00928 len = p - pos; 00929 pos = cloneMem(pos, len + 1); 00930 pos[len] = 0; 00931 return pos; 00932 } 00933 } 00934 return NULL; 00935 }
Here is the call graph for this function:

| void stripChar | ( | char * | s, | |
| char | c | |||
| ) |
Definition at line 1086 of file common.c.
Referenced by axtScoreSchemeDnaWrite().
01088 { 01089 char *in = s, *out = s; 01090 char b; 01091 01092 for (;;) 01093 { 01094 b = *out = *in++; 01095 if (b == 0) 01096 break; 01097 if (b != c) 01098 ++out; 01099 } 01100 }
Here is the caller graph for this function:

| void stripString | ( | char * | s, | |
| char * | strip | |||
| ) |
Definition at line 1102 of file common.c.
References startsWith().
01104 { 01105 char c, *in = s, *out = s; 01106 int stripSize = strlen(strip); 01107 char stripFirst = strip[0]; 01108 01109 while ((c = *in) != 0) 01110 { 01111 c = *in; 01112 if (c == stripFirst) 01113 { 01114 if (startsWith(strip, in)) 01115 { 01116 in += stripSize; 01117 continue; 01118 } 01119 } 01120 *out = c; 01121 ++out; 01122 ++in; 01123 } 01124 *out = 0; 01125 }
Here is the call graph for this function:

| char* strstrNoCase | ( | char * | haystack, | |
| char * | needle | |||
| ) |
Definition at line 1833 of file common.c.
References freeMem(), and needMem().
Referenced by containsStringNoCase().
01843 { 01844 char *haystackCopy = NULL; 01845 char *needleCopy = NULL; 01846 int index = 0; 01847 int haystackLen = 0; 01848 int needleLen = 0; 01849 char *p, *q; 01850 01851 if (NULL == haystack || NULL == needle) 01852 { 01853 return NULL; 01854 } 01855 01856 haystackLen = strlen(haystack); 01857 needleLen = strlen(needle); 01858 01859 haystackCopy = (char*) needMem(haystackLen + 1); 01860 needleCopy = (char*) needMem(needleLen + 1); 01861 01862 for(index = 0; index < haystackLen; index++) 01863 { 01864 haystackCopy[index] = tolower(haystack[index]); 01865 } 01866 haystackCopy[haystackLen] = 0; /* Null terminate */ 01867 01868 for(index = 0; index < needleLen; index++) 01869 { 01870 needleCopy[index] = tolower(needle[index]); 01871 } 01872 needleCopy[needleLen] = 0; /* Null terminate */ 01873 01874 p=strstr(haystackCopy, needleCopy); 01875 q=haystackCopy; 01876 01877 freeMem(haystackCopy); 01878 freeMem(needleCopy); 01879 01880 if(p==NULL) return NULL; 01881 01882 return p-q+haystack; 01883 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void subChar | ( | char * | s, | |
| char | oldChar, | |||
| char | newChar | |||
| ) |
Definition at line 1071 of file common.c.
Referenced by qaStatusOnPage(), semiUniqName(), and undosPath().
01073 { 01074 char c; 01075 for (;;) 01076 { 01077 c = *s; 01078 if (c == 0) 01079 break; 01080 if (c == oldChar) 01081 *s = newChar; 01082 ++s; 01083 } 01084 }
Here is the caller graph for this function:

| void swapBytes | ( | char * | a, | |
| char * | b, | |||
| int | length | |||
| ) |
| void toggleCase | ( | char * | s, | |
| int | size | |||
| ) |
Definition at line 990 of file common.c.
Referenced by bigBlat(), maskNucSeqList(), maskQuerySeq(), readMaskedNib(), and readMaskedTwoBit().
00992 { 00993 char c; 00994 int i; 00995 for (i=0; i<size; ++i) 00996 { 00997 c = s[i]; 00998 if (isupper(c)) 00999 c = tolower(c); 01000 else if (islower(c)) 01001 c = toupper(c); 01002 s[i] = c; 01003 } 01004 }
Here is the caller graph for this function:

| void toLowerN | ( | char * | s, | |
| int | n | |||
| ) |
Definition at line 982 of file common.c.
Referenced by bigBlat(), doBlat(), gfMakeOoc(), trixFindIndexStartLine(), and twoBitReadSeqFragExt().
Here is the caller graph for this function:

| void tolowers | ( | char * | s | ) |
Definition at line 1060 of file common.c.
Referenced by bafWriteLine(), gfPcrClumps(), gfPcrOneViaNet(), netParseUrl(), outputFa(), pslShowAlignmentStranded(), pslShowAlignmentStranded2(), readPartHeaderMB(), wormFixupOrfName(), and wormGeneToOrfNames().
01062 { 01063 char c; 01064 for (;;) 01065 { 01066 if ((c = *s) == 0) break; 01067 *s++ = tolower(c); 01068 } 01069 }
Here is the caller graph for this function:

| void toUpperN | ( | char * | s, | |
| int | n | |||
| ) |
Definition at line 974 of file common.c.
Referenced by bigBlat(), gdfUpcExons(), getWormGeneDna(), maskFromOut(), twoBitReadSeqFragExt(), and wormFixupOrfName().
Here is the caller graph for this function:

| void touppers | ( | char * | s | ) |
Definition at line 1007 of file common.c.
Referenced by checkTagIsInside(), hashLookupUpperCase(), htmlPageValidateOrAbort(), oligoTm(), outputFa(), parseMultiParts(), rnaPair(), and wormGeneRange().
01009 { 01010 char c; 01011 for (;;) 01012 { 01013 if ((c = *s) == 0) break; 01014 *s++ = toupper(c); 01015 } 01016 }
Here is the caller graph for this function:

| char* trimSpaces | ( | char * | s | ) |
Definition at line 1346 of file common.c.
References eraseTrailingSpaces(), and skipLeadingSpaces().
Referenced by dnaLoadNextFromStack(), dnaLoadStackNew(), dtdParse(), dtdxTag(), firstWordInFile(), gfWebConfigRead(), netParseUrl(), readPartHeaderMB(), spacedColumnParseLine(), tabRowByFixedOffsets(), textOutInit(), and twoBitSpecNewFile().
01348 { 01349 if (s != NULL) 01350 { 01351 s = skipLeadingSpaces(s); 01352 eraseTrailingSpaces(s); 01353 } 01354 return s; 01355 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* trueFalseString | ( | boolean | b | ) |
| void uglyTime | ( | char * | label, | |
| ... | ||||
| ) |
Definition at line 1997 of file common.c.
References clock1000().
02000 { 02001 static long lastTime = 0; 02002 long time = clock1000(); 02003 va_list args; 02004 va_start(args, label); 02005 if (label != NULL) 02006 { 02007 vfprintf(stdout, label, args); 02008 fprintf(stdout, ": %ld millis<BR>\n", time - lastTime); 02009 } 02010 lastTime = time; 02011 va_end(args); 02012 }
Here is the call graph for this function:

| int vasafef | ( | char * | buffer, | |
| int | bufSize, | |||
| char * | format, | |||
| va_list | args | |||
| ) |
Definition at line 1885 of file common.c.
References errAbort().
Referenced by safef().
01888 { 01889 int sz = vsnprintf(buffer, bufSize, format, args); 01890 /* note that some version return -1 if too small */ 01891 if ((sz < 0) || (sz >= bufSize)) 01892 errAbort("buffer overflow, size %d, format: %s", bufSize, format); 01893 return sz; 01894 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void writeBits64 | ( | FILE * | f, | |
| bits64 | x | |||
| ) |
| void writeString | ( | FILE * | f, | |
| char * | s | |||
| ) |
Definition at line 1525 of file common.c.
References mustWrite(), UBYTE, warn(), and writeOne.
Referenced by twoBitWriteHeader().
01529 { 01530 UBYTE bLen; 01531 int len = strlen(s); 01532 01533 if (len > 255) 01534 { 01535 warn("String too long in writeString (%d chars):\n%s", len, s); 01536 len = 255; 01537 } 01538 bLen = len; 01539 writeOne(f, bLen); 01540 mustWrite(f, s, len); 01541 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void zeroBytes | ( | void * | vpt, | |
| int | count | |||
| ) |
Definition at line 49 of file common.c.
Referenced by bitClear(), dnaBaseHistogram(), dnaMark0(), dnaMark1(), dnaMarkTriple(), ffShNeedle(), flyFaCommentIntoInfo(), gffClose(), gffOpen(), init_table(), initNtChars(), initNtCompTable(), initNtMixedCaseChars(), internetIpToDottedQuad(), makeIndex(), mgClearPixels(), mgFree(), mgSaveToGif(), saveNt4(), wormFaCommentIntoInfo(), and wormFreeCdnaInfo().
Here is the caller graph for this function:

| char crLfChopper[] = "\n\r" |
char const rcsid[] = "$Id: common.c,v 1.108 2007/03/30 00:12:11 markd Exp $" [static] |
| char whiteSpaceChopper[] = " \t\n\r" |
1.5.2