src/hg/hgTracks/simpleTracks.c 1.117
1.117 2009/12/21 22:43:35 markd
remove fixed length restrion on size of item names. reduce per-item memory usage by removing unusaed array
Index: src/hg/hgTracks/simpleTracks.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/simpleTracks.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -b -B -U 4 -r1.116 -r1.117
--- src/hg/hgTracks/simpleTracks.c 9 Dec 2009 03:30:22 -0000 1.116
+++ src/hg/hgTracks/simpleTracks.c 21 Dec 2009 22:43:35 -0000 1.117
@@ -3371,10 +3371,9 @@
assert(starts != NULL && sizes != NULL && blockCount > 0);
AllocVar(lf);
lf->grayIx = grayIx;
-strncpy(lf->name, bed->name, sizeof(lf->name));
-lf->name[sizeof(lf->name)-1] = 0;
+lf->name = cloneString(bed->name);
lf->orientation = orientFromChar(bed->strand[0]);
for (i=0; i<blockCount; ++i)
{
AllocVar(sf);
@@ -3414,9 +3413,9 @@
{
struct linkedFeatures *lf;
struct simpleFeature *sf;
AllocVar(lf);
- strncpy(lf->name, bed->name, sizeof(lf->name));
+ lf->name = cloneString(bed->name);
lf->start = starts[i] + bed->chromStart;
lf->end = lf->start + sizes[i];
AllocVar(sf);
sf->start = lf->start;
@@ -3882,9 +3881,9 @@
continue;
}
AllocVar(lf);
lf->grayIx = grayIx;
- strncpy(lf->name, gp->name, sizeof(lf->name));
+ lf->name = cloneString(gp->name);
if (extra && gp->name2)
lf->extra = cloneString(gp->name2);
lf->orientation = orientFromChar(gp->strand[0]);
@@ -4078,9 +4077,9 @@
sr = sqlGetResult(conn, query);
if ((row = sqlNextRow(sr)) != NULL)
{
km = knownMoreLoad(row);
- strncpy(lf->name, km->name, sizeof(lf->name));
+ lf->name = cloneString(km->name);
if (km->omimId)
lf->extra = km;
else
knownMoreFree(&km);
@@ -8485,9 +8484,9 @@
boolean rcTarget = (psl->strand[1] == '-');
AllocVar(lf);
lf->grayIx = grayIx;
-strncpy(lf->name, psl->qName, sizeof(lf->name));
+lf->name = cloneString(psl->qName);
lf->orientation = orientFromChar(psl->strand[0]);
if (rcTarget)
lf->orientation = -lf->orientation;
for (i=0; i<blockCount; ++i)
@@ -10394,9 +10393,9 @@
{
static char truncName[128];
struct linkedFeatures *lf = item;
/* todo: make this check a cart variable so it can be hgTrackUi-tweaked. */
-assert(lf->name);
+assert(lf->name != NULL);
if (startsWith("NM_", lf->name) || startsWith("XM_", lf->name))
{
char *ptr = lf->name + 3;
while (isdigit(ptr[0]))