X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Ftable.c;h=a86f407d5f3aa18cab0bbc0376a7eb603de3ceb9;hb=f15c854d8500105766b2f5666bb62b983ff24f88;hp=9e925a44df12300bb35446ae700bef29ace5083c;hpb=c6fe58a22249f4f486b42f35fd8bd537c91e8e6e;p=pspp-builds.git diff --git a/src/output/table.c b/src/output/table.c index 9e925a44..a86f407d 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -537,11 +537,10 @@ tab_value (struct tab_table *table, int c, int r, unsigned char opt, } #endif - contents = pool_alloc (table->container, f->w); - table->cc[c + r * table->cf] = ss_buffer (contents, f->w); - table->ct[c + r * table->cf] = opt; + contents = data_out_pool (v, f, table->container); - data_out (v, f, contents); + table->cc[c + r * table->cf] = ss_cstr (contents); + table->ct[c + r * table->cf] = opt; } /* Sets cell (C,R) in TABLE, with options OPT, to have value VAL @@ -550,8 +549,7 @@ void tab_fixed (struct tab_table *table, int c, int r, unsigned char opt, double val, int w, int d) { - char *contents; - char buf[40], *cp; + char *s, *cp; struct fmt_spec f; union value double_value; @@ -580,17 +578,15 @@ tab_fixed (struct tab_table *table, int c, int r, unsigned char opt, #endif double_value.f = val; - data_out (&double_value, &f, buf); + s = data_out_pool (&double_value, &f, table->container); - cp = buf; - while (isspace ((unsigned char) *cp) && cp < &buf[w]) + cp = s; + while (isspace ((unsigned char) *cp) && cp < &s[w]) cp++; - f.w = w - (cp - buf); + f.w = w - (cp - s); - contents = pool_alloc (table->container, f.w); - table->cc[c + r * table->cf] = ss_buffer (contents, f.w); + table->cc[c + r * table->cf] = ss_buffer (cp, f.w); table->ct[c + r * table->cf] = opt; - memcpy (contents, cp, f.w); } /* Sets cell (C,R) in TABLE, with options OPT, to have value VAL as @@ -602,10 +598,9 @@ tab_double (struct tab_table *table, int c, int r, unsigned char opt, double val, const struct fmt_spec *fmt) { int w; - char *contents; - char buf[40], *cp; + char *s, *cp; - union value double_value; + union value double_value ; assert (table != NULL); @@ -634,17 +629,17 @@ tab_double (struct tab_table *table, int c, int r, unsigned char opt, #endif double_value.f = val; - data_out (&double_value, fmt, buf); + s = data_out_pool (&double_value, fmt, table->container); - cp = buf; - while (isspace ((unsigned char) *cp) && cp < &buf[fmt->w]) - cp++; - w = fmt->w - (cp - buf); - - contents = pool_alloc (table->container, w); - table->cc[c + r * table->cf] = ss_buffer (contents, w); + cp = s; + while (isspace ((unsigned char) *cp) && cp < s + fmt->w) + { + cp++; + } + w = fmt->w - (cp - s); + + table->cc[c + r * table->cf] = ss_buffer (cp, w); table->ct[c + r * table->cf] = opt; - memcpy (contents, cp, w); }