src/hg/hgTracks/cgapSageTrack.c 1.14
1.14 2009/12/21 22:43:32 markd
remove fixed length restrion on size of item names. reduce per-item memory usage by removing unusaed array
Index: src/hg/hgTracks/cgapSageTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/cgapSageTrack.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -b -B -U 4 -r1.13 -r1.14
--- src/hg/hgTracks/cgapSageTrack.c 3 Sep 2008 19:19:01 -0000 1.13
+++ src/hg/hgTracks/cgapSageTrack.c 21 Dec 2009 22:43:32 -0000 1.14
@@ -169,9 +169,9 @@
}
}
if (libsUsed > 0)
{
- safef(skel->name, sizeof(skel->name), "whatever");
+ skel->name = cloneString("whatever");
skel->score = (float)((double)freqTotal * (1000000/tagTotal));
skel->grayIx = grayIxForCgap(skel->score);
addSimpleFeature(skel);
libList = skel;
@@ -190,9 +190,11 @@
struct cgapSageTpmHashEl *tpm = (struct cgapSageTpmHashEl *)tpmEl->val;
char link[256];
char *encTissName = NULL;
double score = 0;
- safef(tiss->name, sizeof(tiss->name), "%s (%d)", tpmEl->name, tpm->count);
+ int len = strlen(tpmEl->name) + 32;
+ tiss->name = needMem(len);
+ safef(tiss->name, len, "%s (%d)", tpmEl->name, tpm->count);
encTissName = cgiEncode(tpmEl->name);
safef(link, sizeof(link), "i=%s&tiss=%s", tag->name, encTissName);
score = (double)tpm->freqTotal*(1000000/(double)tpm->libTotals);
tiss->score = (float)score;
@@ -218,9 +220,9 @@
libName = hashMustFindVal(libHash, libId);
if (keepThisLib(libName, libId))
{
lf = CloneVar(skel);
- safef(lf->name, sizeof(lf->name), "%s", libName);
+ lf->name = cloneString(libName);
safef(link, sizeof(link), "i=%s&lib=%s", tag->name, libId);
lf->score = (float)tag->tagTpms[i];
lf->grayIx = grayIxForCgap(tag->tagTpms[i]);
lf->extra = cloneString(link);