44a6754ee892a6e22e28b8d25acb45c2b47a77ac max Mon Oct 6 22:09:44 2014 -0700 removed my useless function again after code review, refs #14118 diff --git src/hg/lib/fileUi.c src/hg/lib/fileUi.c index 60d5ff7..2481dc0 100644 --- src/hg/lib/fileUi.c +++ src/hg/lib/fileUi.c @@ -97,42 +97,30 @@ FILE *fd = NULL; if ((fd = fopen(buFile.forCgi, "w")) != NULL) { struct fileDb *oneFile = fileList; for (;oneFile != NULL;oneFile=oneFile->next) { char buf[1024]; safef(buf,sizeof buf,"%s %ld %s\n",oneFile->fileName,oneFile->fileSize,oneFile->fileDate); fwrite(buf, strlen(buf), 1, fd); } fclose(fd); } } -void removeChar(char* str, char c) { - /* removes all occurences of a character in a string, in place (libify?) */ - char *pFrom = str; - char *pTo = str; - while (*pFrom!='\0') { - *pTo = *pFrom; - pFrom++; - if (*pTo != c) - pTo++; - } - *pTo = '\0'; -} struct fileDb *fileDbGet(char *db, char *dir, char *subDir, char *fileName) // Returns NULL or if found a fileDb struct with name, size and date filled in. { static char *savedDb = NULL; static char *savedDir = NULL; static char *savedSubDir = NULL; static struct fileDb *foundFiles = NULL;// Use static list to save excess IO struct fileDb *oneFile = NULL; if (foundFiles == NULL || savedDb == NULL || differentString(savedDb, db) || savedDir == NULL || differentString(savedDir,dir) || savedSubDir == NULL || differentString(savedSubDir,subDir)) { // free up any static mem freeMem(savedDb); @@ -165,31 +153,31 @@ server, db, dir, subDir); scriptOutput = popen(cmd, "r"); while (fgets(buf, sizeof(buf), scriptOutput)) { eraseTrailingSpaces(buf); if (!endsWith(buf,".md5sum")) // Just ignore these { int count = chopLine(buf, words); if (count == 5) { //-rw-rw-r-- 26420982 2009/09/29 14:53:30 wgEncodeBroadChipSeq/wgEncode... // rsync 3.1 adds commas: //-rw-rw-r-- 26,420,982 2009/09/29 14:53:30 wgEncodeBroadChipSeq/wgEncode... AllocVar(oneFile); - removeChar(words[1], ','); + stripChar(words[1], ','); oneFile->fileSize = sqlUnsignedLong(words[1]); oneFile->fileDate = cloneString(words[2]); strSwapChar(oneFile->fileDate,'/','-');// Standardize YYYY-MM-DD, no time oneFile->fileName = cloneString(words[4]); slAddHead(&foundFiles,oneFile); } } } pclose(scriptOutput); if (foundFiles == NULL) { foundFiles = fileDbReadFromBackup(db, dir, subDir); if (foundFiles == NULL) { AllocVar(oneFile);