From 7c3b7d27446cbe7e4d1ccf6f51caf2d38f55916c Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Mon, 14 Dec 1998 05:19:16 +0000 Subject: Initial attempt to clean up the code... Switch sprintf() to snprintf() Remove any/all #if 0 -or- #ifdef NOT_USED -or- #ifdef FALSE sections of code --- src/backend/access/gist/gist.c | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'src/backend/access/gist/gist.c') diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index f57c0432b5e..a7617842042 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -1326,34 +1326,6 @@ _gistdump(Relation r) } } -#ifdef NOT_USED -static char * -text_range_out(TXTRANGE *r) -{ - char *result; - char *lower, - *upper; - - if (r == NULL) - return NULL; - result = (char *) palloc(NAMEDATALEN + VARSIZE(TRLOWER(r)) + VARSIZE(TRUPPER(r)) - - 2 * VARHDRSZ); - - lower = (char *) palloc(VARSIZE(TRLOWER(r)) + 1 - VARHDRSZ); - memcpy(lower, VARDATA(TRLOWER(r)), VARSIZE(TRLOWER(r)) - VARHDRSZ); - lower[VARSIZE(TRLOWER(r)) - VARHDRSZ] = '\0'; - upper = (char *) palloc(VARSIZE(TRUPPER(r)) + 1 - VARHDRSZ); - memcpy(upper, VARDATA(TRUPPER(r)), VARSIZE(TRUPPER(r)) - VARHDRSZ); - upper[VARSIZE(TRUPPER(r)) - VARHDRSZ] = '\0'; - - sprintf(result, "[%s,%s): %d", lower, upper, r->flag); - pfree(lower); - pfree(upper); - return result; -} - -#endif - static char * int_range_out(INTRANGE *r) { @@ -1362,7 +1334,7 @@ int_range_out(INTRANGE *r) if (r == NULL) return NULL; result = (char *) palloc(80); - sprintf(result, "[%d,%d): %d", r->lower, r->upper, r->flag); + snprintf(result, 80, "[%d,%d): %d", r->lower, r->upper, r->flag); return result; } -- cgit v1.2.3