e70152e44cc66cc599ff6b699eb8adc07f3e656a kent Sat May 24 21:09:34 2014 -0700 Adding Copyright NNNN Regents of the University of California to all files I believe with reasonable certainty were developed under UCSC employ or as part of Genome Browser copyright assignment. diff --git src/hg/lib/stsAlias.c src/hg/lib/stsAlias.c index 8bbc863..dab03ae 100644 --- src/hg/lib/stsAlias.c +++ src/hg/lib/stsAlias.c @@ -1,107 +1,110 @@ /* stsAlias.c was originally generated by the autoSql program, which also * generated stsAlias.h and stsAlias.sql. This module links the database and * the RAM representation of objects. */ +/* Copyright (C) 2014 The Regents of the University of California + * See README in this or parent directory for licensing information. */ + #include "common.h" #include "linefile.h" #include "jksql.h" #include "stsAlias.h" void stsAliasStaticLoad(char **row, struct stsAlias *ret) /* Load a row from stsAlias table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->alias = row[0]; ret->identNo = sqlUnsigned(row[1]); ret->trueName = row[2]; } struct stsAlias *stsAliasLoad(char **row) /* Load a stsAlias from row fetched with select * from stsAlias * from database. Dispose of this with stsAliasFree(). */ { struct stsAlias *ret; AllocVar(ret); ret->alias = cloneString(row[0]); ret->identNo = sqlUnsigned(row[1]); ret->trueName = cloneString(row[2]); return ret; } struct stsAlias *stsAliasLoadAll(char *fileName) /* Load all stsAlias from a tab-separated file. * Dispose of this with stsAliasFreeList(). */ { struct stsAlias *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[3]; while (lineFileRow(lf, row)) { el = stsAliasLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct stsAlias *stsAliasCommaIn(char **pS, struct stsAlias *ret) /* Create a stsAlias out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new stsAlias */ { char *s = *pS; if (ret == NULL) AllocVar(ret); ret->alias = sqlStringComma(&s); ret->identNo = sqlUnsignedComma(&s); ret->trueName = sqlStringComma(&s); *pS = s; return ret; } void stsAliasFree(struct stsAlias **pEl) /* Free a single dynamically allocated stsAlias such as created * with stsAliasLoad(). */ { struct stsAlias *el; if ((el = *pEl) == NULL) return; freeMem(el->alias); freeMem(el->trueName); freez(pEl); } void stsAliasFreeList(struct stsAlias **pList) /* Free a list of dynamically allocated stsAlias's */ { struct stsAlias *el, *next; for (el = *pList; el != NULL; el = next) { next = el->next; stsAliasFree(&el); } *pList = NULL; } void stsAliasOutput(struct stsAlias *el, FILE *f, char sep, char lastSep) /* Print out stsAlias. Separate fields with sep. Follow last field with lastSep. */ { if (sep == ',') fputc('"',f); fprintf(f, "%s", el->alias); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%u", el->identNo); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->trueName); if (sep == ',') fputc('"',f); fputc(lastSep,f); }