[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src output/postscript.c output/output.c ou...
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] pspp/src output/postscript.c output/output.c ou... |
Date: |
Mon, 15 May 2006 03:53:34 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Branch:
Changes by: Ben Pfaff <address@hidden> 06/05/15 03:53:33
Modified files:
src/output : postscript.c output.c ascii.c afm.c
src/libpspp : str.h str.c ChangeLog
src/language/lexer: lexer.c
src/language/expressions: parse.c
src/language/data-io: list.q data-reader.c
src/language/control: repeat.c
src/language : line-buffer.c command.c
src/data : sys-file-writer.c por-file-reader.c data-in.c
Log message:
Get rid of capacity argument to ds_init() and update all callers.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/output/postscript.c.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/output/output.c.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/output/ascii.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/output/afm.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/libpspp/str.h.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/libpspp/str.c.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/libpspp/ChangeLog.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/lexer/lexer.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/expressions/parse.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/data-io/list.q.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/data-io/data-reader.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/control/repeat.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/line-buffer.c.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/command.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/sys-file-writer.c.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/por-file-reader.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/data-in.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: pspp/src/data/data-in.c
diff -u pspp/src/data/data-in.c:1.9 pspp/src/data/data-in.c:1.10
--- pspp/src/data/data-in.c:1.9 Sun May 7 02:18:32 2006
+++ pspp/src/data/data-in.c Mon May 15 03:53:33 2006
@@ -54,7 +54,7 @@
if (i->flags & DI_IGNORE_ERROR)
return;
- ds_init (&text, 64);
+ ds_init (&text);
if (i->f1 == i->f2)
ds_printf (&text, _("(column %d"), i->f1);
else
Index: pspp/src/data/por-file-reader.c
diff -u pspp/src/data/por-file-reader.c:1.9 pspp/src/data/por-file-reader.c:1.10
--- pspp/src/data/por-file-reader.c:1.9 Tue Apr 25 00:41:12 2006
+++ pspp/src/data/por-file-reader.c Mon May 15 03:53:33 2006
@@ -89,7 +89,7 @@
struct string text;
va_list args;
- ds_init (&text, 64);
+ ds_init (&text);
ds_printf (&text, _("portable file %s corrupt at offset %ld: "),
fh_get_file_name (r->fh), ftell (r->file));
va_start (args, msg);
Index: pspp/src/data/sys-file-writer.c
diff -u pspp/src/data/sys-file-writer.c:1.10
pspp/src/data/sys-file-writer.c:1.11
--- pspp/src/data/sys-file-writer.c:1.10 Sun May 7 02:18:32 2006
+++ pspp/src/data/sys-file-writer.c Mon May 15 03:53:33 2006
@@ -686,7 +686,7 @@
struct string vls_length_map;
- ds_init (&vls_length_map, 12 * dict_get_var_cnt (dict));
+ ds_init (&vls_length_map);
vls_hdr.rec_type = 7;
vls_hdr.subtype = 14;
@@ -732,7 +732,7 @@
struct string long_name_map;
size_t i;
- ds_init (&long_name_map, 10 * dict_get_var_cnt (dict));
+ ds_init (&long_name_map);
for (i = 0; i < dict_get_var_cnt (dict); i++)
{
struct variable *v = dict_get_var (dict, i);
Index: pspp/src/language/command.c
diff -u pspp/src/language/command.c:1.9 pspp/src/language/command.c:1.10
--- pspp/src/language/command.c:1.9 Fri May 5 04:53:12 2006
+++ pspp/src/language/command.c Mon May 15 03:53:33 2006
@@ -430,7 +430,7 @@
struct string s;
size_t i;
- ds_init (&s, 0);
+ ds_init (&s);
for (i = 0; i < word_cnt; i++)
{
if (i != 0)
Index: pspp/src/language/control/repeat.c
diff -u pspp/src/language/control/repeat.c:1.8
pspp/src/language/control/repeat.c:1.9
--- pspp/src/language/control/repeat.c:1.8 Mon May 8 01:21:38 2006
+++ pspp/src/language/control/repeat.c Mon May 15 03:53:33 2006
@@ -469,7 +469,7 @@
struct string output;
bool dot;
- ds_init (&output, ds_capacity (line));
+ ds_init (&output);
/* Strip trailing whitespace, check for & remove terminal dot. */
while (isspace (ds_last (line)))
Index: pspp/src/language/data-io/data-reader.c
diff -u pspp/src/language/data-io/data-reader.c:1.9
pspp/src/language/data-io/data-reader.c:1.10
--- pspp/src/language/data-io/data-reader.c:1.9 Fri May 5 04:53:12 2006
+++ pspp/src/language/data-io/data-reader.c Mon May 15 03:53:33 2006
@@ -120,8 +120,8 @@
r = xmalloc (sizeof *r);
r->fh = fh;
- ds_init (&r->line, 64);
- ds_init (&r->scratch, 0);
+ ds_init (&r->line);
+ ds_init (&r->scratch);
r->flags = DFM_ADVANCE;
r->eof_cnt = 0;
if (fh != fh_inline_file ())
Index: pspp/src/language/data-io/list.q
diff -u pspp/src/language/data-io/list.q:1.10
pspp/src/language/data-io/list.q:1.11
--- pspp/src/language/data-io/list.q:1.10 Sun May 7 05:26:03 2006
+++ pspp/src/language/data-io/list.q Mon May 15 03:53:33 2006
@@ -604,7 +604,7 @@
d->cp_y += d->font_height;
}
- ds_init(&line_buffer, largest_page_width + 2);
+ ds_init (&line_buffer);
}
/* Writes case C to output. */
Index: pspp/src/language/expressions/parse.c
diff -u pspp/src/language/expressions/parse.c:1.8
pspp/src/language/expressions/parse.c:1.9
--- pspp/src/language/expressions/parse.c:1.8 Fri May 5 04:53:13 2006
+++ pspp/src/language/expressions/parse.c Mon May 15 03:53:33 2006
@@ -1112,7 +1112,7 @@
struct string s;
const struct operation *f;
- ds_init (&s, 128);
+ ds_init (&s);
if (last - first == 1)
{
Index: pspp/src/language/lexer/lexer.c
diff -u pspp/src/language/lexer/lexer.c:1.4 pspp/src/language/lexer/lexer.c:1.5
--- pspp/src/language/lexer/lexer.c:1.4 Wed Apr 26 20:54:08 2006
+++ pspp/src/language/lexer/lexer.c Mon May 15 03:53:33 2006
@@ -104,8 +104,8 @@
void
lex_init (void)
{
- ds_init (&tokstr, 64);
- ds_init (&put_tokstr, 64);
+ ds_init (&tokstr);
+ ds_init (&put_tokstr);
if (!lex_get_line ())
eof = true;
}
Index: pspp/src/language/line-buffer.c
diff -u pspp/src/language/line-buffer.c:1.10
pspp/src/language/line-buffer.c:1.11
--- pspp/src/language/line-buffer.c:1.10 Tue Apr 25 18:03:03 2006
+++ pspp/src/language/line-buffer.c Mon May 15 03:53:33 2006
@@ -111,7 +111,7 @@
{
ds_create (&getl_include_path,
fn_getenv_default ("STAT_INCLUDE_PATH", include_path));
- ds_init (&getl_buf, 256);
+ ds_init (&getl_buf);
init_prompts ();
}
Index: pspp/src/libpspp/ChangeLog
diff -u pspp/src/libpspp/ChangeLog:1.23 pspp/src/libpspp/ChangeLog:1.24
--- pspp/src/libpspp/ChangeLog:1.23 Wed May 10 03:47:38 2006
+++ pspp/src/libpspp/ChangeLog Mon May 15 03:53:33 2006
@@ -1,3 +1,8 @@
+Sun May 14 20:52:20 2006 Ben Pfaff <address@hidden>
+
+ * str.c (ds_init): Remove `capacity' argument and just initialize
+ the string to a capacity of zero. Updated all callers.
+
Tue May 9 09:56:57 2006 Ben Pfaff <address@hidden>
* va_copy.h: Removed. Now use va_copy() provided by gnulib
Index: pspp/src/libpspp/str.c
diff -u pspp/src/libpspp/str.c:1.10 pspp/src/libpspp/str.c:1.11
--- pspp/src/libpspp/str.c:1.10 Wed May 10 03:47:38 2006
+++ pspp/src/libpspp/str.c Mon May 15 03:53:33 2006
@@ -247,13 +247,13 @@
strcpy (st->string, s);
}
-/* Initializes ST, making room for at least CAPACITY characters. */
+/* Initializes ST as an empty string. */
void
-ds_init (struct string *st, size_t capacity)
+ds_init (struct string *st)
{
st->length = 0;
- st->capacity = MAX (8, capacity);
- st->string = xmalloc (st->capacity + 1);
+ st->capacity = 0;
+ st->string = NULL;
}
/* Frees ST. */
@@ -285,7 +285,7 @@
const struct string *src, size_t idx, size_t cnt)
{
assert (dst != src);
- ds_init (dst, cnt);
+ ds_init (dst);
ds_assign_substring (dst, src, idx, cnt);
}
Index: pspp/src/libpspp/str.h
diff -u pspp/src/libpspp/str.h:1.7 pspp/src/libpspp/str.h:1.8
--- pspp/src/libpspp/str.h:1.7 Tue May 2 03:51:43 2006
+++ pspp/src/libpspp/str.h Mon May 15 03:53:33 2006
@@ -117,7 +117,7 @@
#define DS_INITIALIZER {NULL, 0, 0}
/* Constructors, destructors. */
-void ds_init (struct string *, size_t);
+void ds_init (struct string *);
void ds_init_substring (struct string *,
const struct string *src, size_t start, size_t cnt);
void ds_create (struct string *, const char *);
Index: pspp/src/output/afm.c
diff -u pspp/src/output/afm.c:1.1 pspp/src/output/afm.c:1.2
--- pspp/src/output/afm.c:1.1 Mon Apr 3 20:07:54 2006
+++ pspp/src/output/afm.c Mon May 15 03:53:33 2006
@@ -720,7 +720,7 @@
struct string s;
int c;
- ds_init (&s, 0);
+ ds_init (&s);
while (!isspace (c = getc (p->file)) && c != EOF)
ds_putc (&s, c);
ungetc (c, p->file);
@@ -756,9 +756,8 @@
static bool
get_string (struct parser *p, char **string)
{
- struct string s;
+ struct string s = DS_INITIALIZER;
- ds_init (&s, 0);
skip_spaces (p);
for (;;)
{
Index: pspp/src/output/ascii.c
diff -u pspp/src/output/ascii.c:1.7 pspp/src/output/ascii.c:1.8
--- pspp/src/output/ascii.c:1.7 Mon Apr 17 01:30:21 2006
+++ pspp/src/output/ascii.c Mon May 15 03:53:33 2006
@@ -672,7 +672,7 @@
struct string out;
int line_num;
- ds_init (&out, 128);
+ ds_init (&out);
ds_putc_multiple (&out, '\n', x->top_margin);
if (x->headers)
Index: pspp/src/output/output.c
diff -u pspp/src/output/output.c:1.12 pspp/src/output/output.c:1.13
--- pspp/src/output/output.c:1.12 Sun May 14 21:05:13 2006
+++ pspp/src/output/output.c Mon May 15 03:53:33 2006
@@ -286,7 +286,7 @@
config_path),
NULL);
- ds_init (&line, 128);
+ ds_init (&line);
if (init_fn == NULL)
{
@@ -767,7 +767,7 @@
for (i = 0; i < 4; i++)
{
struct string *token = &tokens[i];
- ds_init (token, 0);
+ ds_init (token);
ds_separate (line, token, i < 3 ? ":" : "", &save_idx);
ds_trim_spaces (token);
}
@@ -1032,7 +1032,7 @@
config_path),
NULL);
- ds_init (&line, 128);
+ ds_init (&line);
if (pprsz_fn == NULL)
{
Index: pspp/src/output/postscript.c
diff -u pspp/src/output/postscript.c:1.16 pspp/src/output/postscript.c:1.17
--- pspp/src/output/postscript.c:1.16 Sun May 14 20:56:44 2006
+++ pspp/src/output/postscript.c Mon May 15 03:53:33 2006
@@ -874,7 +874,7 @@
fprintf (ext->file, "F%d setfont\n", font);
}
- ds_init (&out, 0);
+ ds_init (&out);
for (i = 0; i < char_cnt; i = j)
{
for (j = i + 1; j < char_cnt; j++)
@@ -1382,7 +1382,7 @@
line_number = 0;
- ds_init (&line, 0);
+ ds_init (&line);
while (ds_get_config_line (file, &line, &line_number))
{
char *pschar, *code;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp/src output/postscript.c output/output.c ou...,
Ben Pfaff <=