d8400c6f01be26c33617129a96154b2e2186f023
hiram
Mon May 15 14:10:46 2023 -0700
under protest revert ac57c34ad3a97779a948f4f716d704c22061c98 per code review refs #31274
diff --git src/hg/lib/hubConnect.c src/hg/lib/hubConnect.c
index cc2488c..d6dff78 100644
--- src/hg/lib/hubConnect.c
+++ src/hg/lib/hubConnect.c
@@ -194,31 +194,31 @@
{
AllocVar(hub);
hub->id = id;
hub->hubUrl = cloneString(row[0]);
hub->status = sqlUnsigned(row[1]);
hub->errorMessage = cloneString(row[2]);
hub->shortLabel = cloneString(row[4]);
if (isEmpty(row[2]) || hubTimeToCheck(hub, row[3]))
{
char *errorMessage = NULL;
hub->trackHub = fetchHub( hub, &errorMessage);
if (hub->trackHub)
hub->trackHub->hubStatus = hub;
hub->errorMessage = cloneString(errorMessage);
hubUpdateStatus( hub->errorMessage, hub);
- if (isNotEmpty(hub->errorMessage))
+ if (!isEmpty(hub->errorMessage))
{
boolean isCollection = (strstr(hub->hubUrl, "hgComposite") != NULL);
if (isCollection)
warn("You created a Track "
"Collection that has expired and been removed. Track Collections "
"expire 48 hours after their last use. "
"Save your session to preserve collections long-term and to allow sharing.");
// commenting this out, but leaving it in the source because we might use it later.
//else
//warn("Could not connect to hub \"%s\": %s", hub->shortLabel, hub->errorMessage);
}
}
}
sqlFreeResult(&sr);
return hub;
@@ -249,31 +249,31 @@
return hubList;
}
struct hubConnectStatus *hubConnectStatusListFromCart(struct cart *cart)
/* Return list of track hubs that are turned on by user in cart. */
{
struct hubConnectStatus *hubList = NULL, *hub;
struct slName *name, *nameList = hubConnectHubsInCart(cart);
struct sqlConnection *conn = hConnectCentral();
for (name = nameList; name != NULL; name = name->next)
{
int id = sqlSigned(name->name);
hub = hubConnectStatusForId(conn, id);
if (hub != NULL)
{
- if (isNotEmpty(hub->errorMessage) && (strstr(hub->hubUrl, "hgComposite") != NULL))
+ if (!isEmpty(hub->errorMessage) && (strstr(hub->hubUrl, "hgComposite") != NULL))
{
// custom collection hub has disappeared. Remove it from cart
cartSetString(cart, hgHubConnectRemakeTrackHub, "on");
char buffer[1024];
safef(buffer, sizeof buffer, "hgHubConnect.hub.%d", id);
cartRemove(cart, buffer);
}
else
slAddHead(&hubList, hub);
}
}
slFreeList(&nameList);
hDisconnectCentral(&conn);
slReverse(&hubList);
return hubList;
@@ -316,31 +316,31 @@
trackName += 4;
trackName = strchr(trackName, '_');
assert(trackName != NULL);
return trackName + 1;
}
struct hubConnectStatus *hubFromId(unsigned hubId)
/* Given a hub ID number, return corresponding trackHub structure.
* ErrAbort if there's a problem. */
{
struct sqlConnection *conn = hConnectCentral();
struct hubConnectStatus *status = hubConnectStatusForId(conn, hubId);
hDisconnectCentral(&conn);
if (status == NULL)
errAbort("The hubId %d was not found", hubId);
-if (isNotEmpty(status->errorMessage))
+if (!isEmpty(status->errorMessage))
errAbort("%s", status->errorMessage);
return status;
}
static struct trackDb *findSuperTrack(struct trackDb *tdbList, char *trackName)
/* discover any supertracks, and if there are some add them
* to the subtrack list of the supertrack */
{
struct trackDb *tdb;
struct trackDb *p = NULL;
struct trackDb *next;
for(tdb = tdbList; tdb; tdb = next)
{
/* save away the next pointer becuase we may detach this node and
@@ -466,31 +466,31 @@
char *statusTableName = getHubStatusTableName();
sqlSafef(query, sizeof(query), "select id,errorMessage from %s where hubUrl = \"%s\"", statusTableName, url);
struct sqlResult *sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
if (foundOne)
errAbort("more than one line in %s with hubUrl %s\n",
statusTableName, url);
foundOne = TRUE;
char *thisId = row[0], *thisError = row[1];
- if (isNotEmpty(thisError))
+ if (!isEmpty(thisError))
*errorMessage = cloneString(thisError);
id = sqlUnsigned(thisId);
}
sqlFreeResult(&sr);
hDisconnectCentral(&conn);
return id;
}
static struct hubConnectStatus *getAndSetHubStatus( struct cart *cart, char *url,
boolean set)
/* make sure url is in hubStatus table, fetch the hub to get latest
* labels and db information.
@@ -1004,91 +1004,91 @@
curatedHubPrefix = "public";
return curatedHubPrefix;
}
boolean hubConnectGetCuratedUrl(char *db, char **hubUrl)
/* Check to see if this db is a curated hub and if so return its hubUrl */
{
struct sqlConnection *conn = hConnectCentral();
char query[4096];
sqlSafef(query, sizeof query, "SELECT nibPath from %s where name = '%s' AND nibPath like '%s%%'",
dbDbTable(), db, hubCuratedPrefix);
char *dir = sqlQuickString(conn, query);
-boolean ret = isNotEmpty(dir);
+boolean ret = !isEmpty(dir);
hDisconnectCentral(&conn);
if (hubUrl != NULL) // if user passed in hubUrl, calculate what it should be
{
*hubUrl = NULL;
- if (ret) // this is a curated hub
+ if (!isEmpty(dir)) // this is a curated hub
{
char *path = dir + sizeof(hubCuratedPrefix) - 1;
char url[4096];
safef(url, sizeof url, "%s/%s/hub.txt", path, getCuratedHubPrefix());
*hubUrl = cloneString(url);
}
}
return ret;
}
boolean hubConnectIsCurated(char *db)
/* Look in the dbDb table to see if this hub is curated. */
{
return hubConnectGetCuratedUrl(db, NULL);
}
static int lookForCuratedHubs(struct cart *cart, char *db, char *curatedHubPrefix)
/* Check to see if db is a curated hub which will require the hub to be attached.
* The variable curatedHubPrefix has the release to use (alpha, beta, public, or a user name ) */
{
struct sqlConnection *conn = hConnectCentral();
char query[4096];
sqlSafef(query, sizeof query, "SELECT nibPath from %s where name = '%s' AND nibPath like '%s%%'",
dbDbTable(), db, hubCuratedPrefix);
char *dir = cloneString(sqlQuickString(conn, query));
hDisconnectCentral(&conn);
-if (isNotEmpty(dir))
+if (!isEmpty(dir))
{
char *path = &dir[sizeof hubCuratedPrefix - 1];
char url[4096];
safef(url, sizeof url, "%s/%s/hub.txt", path, curatedHubPrefix);
struct hubConnectStatus *status = getAndSetHubStatus( cart, url, TRUE);
if (status && isEmpty(status->errorMessage))
{
char buffer[4096];
safef(buffer, sizeof buffer, "hub_%d_%s", status->id, db);
cartSetString(cart, "db", buffer);
if (cgiOptionalString("db"))
{
/* user specified db on URL, we need to decorate and put it back. */
cgiVarSet("db", cloneString(buffer));
}
return status->id;
}
else
{
- if (isNotEmpty(status->errorMessage))
+ if (!isEmpty(status->errorMessage))
errAbort("Hub error: url %s: error %s.", url, status->errorMessage);
else
errAbort("Cannot open hub %s.", url);
}
}
return 0;
}
static void portHubStatus(struct cart *cart)
/* When a session has been saved on a different host it may have cart variables that reference hubStatus id's
* that are different than what the local machine has. Look for these cases using the "assumesHub" cart variable
* that maps id numbers to URL's. */
{
char *assumesHubStr = cartOptionalString(cart, "assumesHub");