From: Ben Pfaff Date: Tue, 26 May 2009 03:22:01 +0000 (-0700) Subject: Use MAX_SHORT_STRING in place of MIN_LONG_STRING. X-Git-Tag: v0.7.3~72 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18021ef879fa68dbec546155311d6676653cf7c3;p=pspp-builds.git Use MAX_SHORT_STRING in place of MIN_LONG_STRING. There is no good reason to have both of these constants, so replace all uses of MAX_LONG_STRING by MAX_SHORT_STRING. --- diff --git a/src/data/caseproto.c b/src/data/caseproto.c index 1b6827db..1a40213a 100644 --- a/src/data/caseproto.c +++ b/src/data/caseproto.c @@ -330,7 +330,7 @@ caseproto_refresh_long_string_cache__ (const struct caseproto *proto_) * sizeof *proto->long_strings); n = 0; for (i = 0; i < proto->n_widths; i++) - if (proto->widths[i] >= MIN_LONG_STRING) + if (proto->widths[i] > MAX_SHORT_STRING) proto->long_strings[n++] = i; assert (n == proto->n_long_strings); } @@ -406,6 +406,6 @@ count_long_strings (const struct caseproto *proto, size_t idx, size_t count) n = 0; for (i = 0; i < count; i++) - n += proto->widths[idx + i] >= MIN_LONG_STRING; + n += proto->widths[idx + i] > MAX_SHORT_STRING; return n; } diff --git a/src/data/caseproto.h b/src/data/caseproto.h index ba091e6b..b85a9f32 100644 --- a/src/data/caseproto.h +++ b/src/data/caseproto.h @@ -183,8 +183,8 @@ caseproto_get_n_widths (const struct caseproto *proto) void caseproto_refresh_long_string_cache__ (const struct caseproto *); /* Returns the number of long string widths in PROTO; that is, - the number of widths in PROTO that are greater than or equal - to MIN_LONG_STRING. */ + the number of widths in PROTO that are greater than to + MAX_SHORT_STRING. */ static inline size_t caseproto_get_n_long_strings (const struct caseproto *proto) { @@ -193,7 +193,7 @@ caseproto_get_n_long_strings (const struct caseproto *proto) /* Given long string width IDX1, returns a value IDX2 for which caseproto_get_width(PROTO, IDX2) will return a value greater - than or equal to MIN_LONG_STRING. IDX1 must be less than + than MAX_SHORT_STRING. IDX1 must be less than caseproto_get_n_long_strings(PROTO), and IDX2 will be less than caseproto_get_n_widths(PROTO). */ static inline size_t diff --git a/src/data/value.c b/src/data/value.c index 71a2dc94..ce050c01 100644 --- a/src/data/value.c +++ b/src/data/value.c @@ -192,8 +192,8 @@ value_needs_resize (int old_width, int new_width) anyway in hopes of saving memory.) */ return (old_width != new_width && (new_width > old_width - || old_width >= MIN_LONG_STRING - || new_width >= MIN_LONG_STRING)); + || old_width > MAX_SHORT_STRING + || new_width > MAX_SHORT_STRING)); } /* Same as value_init, except that memory for VALUE (if diff --git a/src/data/value.h b/src/data/value.h index 8f174633..90f85753 100644 --- a/src/data/value.h +++ b/src/data/value.h @@ -24,7 +24,6 @@ #include "xalloc.h" #define MAX_SHORT_STRING 8 -#define MIN_LONG_STRING (MAX_SHORT_STRING + 1) /* A numeric or string value. @@ -148,7 +147,7 @@ static inline const char * value_str (const union value *v, int width) { assert (width > 0); - return (width >= MIN_LONG_STRING ? v->long_string : v->short_string); + return (width > MAX_SHORT_STRING ? v->long_string : v->short_string); } /* Returns the string value in V, which must have width WIDTH. @@ -162,7 +161,7 @@ static inline char * value_str_rw (union value *v, int width) { assert (width > 0); - return (width >= MIN_LONG_STRING ? v->long_string : v->short_string); + return (width > MAX_SHORT_STRING ? v->long_string : v->short_string); } /* Copies SRC to DST, given that they both contain data of the