projects
/
pspp-builds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6a28b70
)
Get rid of capacity argument to ds_init() and update all callers.
author
Ben Pfaff
<blp@gnu.org>
Mon, 15 May 2006 03:53:33 +0000
(
03:53
+0000)
committer
Ben Pfaff
<blp@gnu.org>
Mon, 15 May 2006 03:53:33 +0000
(
03:53
+0000)
17 files changed:
src/data/data-in.c
patch
|
blob
|
history
src/data/por-file-reader.c
patch
|
blob
|
history
src/data/sys-file-writer.c
patch
|
blob
|
history
src/language/command.c
patch
|
blob
|
history
src/language/control/repeat.c
patch
|
blob
|
history
src/language/data-io/data-reader.c
patch
|
blob
|
history
src/language/data-io/list.q
patch
|
blob
|
history
src/language/expressions/parse.c
patch
|
blob
|
history
src/language/lexer/lexer.c
patch
|
blob
|
history
src/language/line-buffer.c
patch
|
blob
|
history
src/libpspp/ChangeLog
patch
|
blob
|
history
src/libpspp/str.c
patch
|
blob
|
history
src/libpspp/str.h
patch
|
blob
|
history
src/output/afm.c
patch
|
blob
|
history
src/output/ascii.c
patch
|
blob
|
history
src/output/output.c
patch
|
blob
|
history
src/output/postscript.c
patch
|
blob
|
history
diff --git
a/src/data/data-in.c
b/src/data/data-in.c
index b4658582f4192ba69923967d4802cf46ade26dc1..4e2e8fcbfb867a249d4152386b21d4a293bc7f61 100644
(file)
--- a/
src/data/data-in.c
+++ b/
src/data/data-in.c
@@
-54,7
+54,7
@@
vdls_error (const struct data_in *i, const char *format, va_list args)
if (i->flags & DI_IGNORE_ERROR)
return;
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
if (i->f1 == i->f2)
ds_printf (&text, _("(column %d"), i->f1);
else
diff --git
a/src/data/por-file-reader.c
b/src/data/por-file-reader.c
index a4e3b0cb9988dfbd5be2d4b924f4db3c4c03adf8..377241ef33b861fce3b773610030cef761660d8e 100644
(file)
--- a/
src/data/por-file-reader.c
+++ b/
src/data/por-file-reader.c
@@
-89,7
+89,7
@@
error (struct pfm_reader *r, const char *msg, ...)
struct string text;
va_list args;
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);
ds_printf (&text, _("portable file %s corrupt at offset %ld: "),
fh_get_file_name (r->fh), ftell (r->file));
va_start (args, msg);
diff --git
a/src/data/sys-file-writer.c
b/src/data/sys-file-writer.c
index b4d4ff29b99cc9b8d8a8728f7510f78ba8159b62..dda351b9572ef9b77c27045c67077b9193eaa31b 100644
(file)
--- a/
src/data/sys-file-writer.c
+++ b/
src/data/sys-file-writer.c
@@
-686,7
+686,7
@@
write_vls_length_table (struct sfm_writer *w,
struct string vls_length_map;
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;
vls_hdr.rec_type = 7;
vls_hdr.subtype = 14;
@@
-732,7
+732,7
@@
write_longvar_table (struct sfm_writer *w, const struct dictionary *dict)
struct string long_name_map;
size_t i;
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);
for (i = 0; i < dict_get_var_cnt (dict); i++)
{
struct variable *v = dict_get_var (dict, i);
diff --git
a/src/language/command.c
b/src/language/command.c
index 1e040d6c677deb202604844e746c25c3d9555d18..7b903ab1a29f64a916d7f3891b960a2c3b6c4952 100644
(file)
--- a/
src/language/command.c
+++ b/
src/language/command.c
@@
-430,7
+430,7
@@
unknown_command_error (char *const words[], size_t word_cnt)
struct string s;
size_t i;
struct string s;
size_t i;
- ds_init (&s
, 0
);
+ ds_init (&s);
for (i = 0; i < word_cnt; i++)
{
if (i != 0)
for (i = 0; i < word_cnt; i++)
{
if (i != 0)
diff --git
a/src/language/control/repeat.c
b/src/language/control/repeat.c
index b68973614907896244b43ae677fcfdb7079e8381..b5efdc99f6c797c1eb02ceee15395abed643955c 100644
(file)
--- a/
src/language/control/repeat.c
+++ b/
src/language/control/repeat.c
@@
-469,7
+469,7
@@
do_repeat_filter (struct string *line, void *block_)
struct string output;
bool dot;
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)))
/* Strip trailing whitespace, check for & remove terminal dot. */
while (isspace (ds_last (line)))
diff --git
a/src/language/data-io/data-reader.c
b/src/language/data-io/data-reader.c
index a8b484d469010808af15ac90e9098225086c9123..e26941b0f66c379bbbfa616226f8b7113c4bc49c 100644
(file)
--- a/
src/language/data-io/data-reader.c
+++ b/
src/language/data-io/data-reader.c
@@
-120,8
+120,8
@@
dfm_open_reader (struct file_handle *fh)
r = xmalloc (sizeof *r);
r->fh = fh;
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 ())
r->flags = DFM_ADVANCE;
r->eof_cnt = 0;
if (fh != fh_inline_file ())
diff --git
a/src/language/data-io/list.q
b/src/language/data-io/list.q
index b1bb9aadf05d35c3724af8453a507f8d6e23fe0c..84b1ac81baa8b2fb9bf9e5f9e4f5957b585c531d 100644
(file)
--- a/
src/language/data-io/list.q
+++ b/
src/language/data-io/list.q
@@
-604,7
+604,7
@@
determine_layout (void)
d->cp_y += d->font_height;
}
d->cp_y += d->font_height;
}
- ds_init
(&line_buffer, largest_page_width + 2
);
+ ds_init
(&line_buffer
);
}
/* Writes case C to output. */
}
/* Writes case C to output. */
diff --git
a/src/language/expressions/parse.c
b/src/language/expressions/parse.c
index 715430087fa8ebb20bf088f2298c535db0624268..81ed4da88fd7c06f97b2145a60b47b0c98fbc788 100644
(file)
--- a/
src/language/expressions/parse.c
+++ b/
src/language/expressions/parse.c
@@
-1112,7
+1112,7
@@
no_match (const char *func_name,
struct string s;
const struct operation *f;
struct string s;
const struct operation *f;
- ds_init (&s
, 128
);
+ ds_init (&s);
if (last - first == 1)
{
if (last - first == 1)
{
diff --git
a/src/language/lexer/lexer.c
b/src/language/lexer/lexer.c
index 4cb3f593095f5c9f4c18d82a0e54a53ccbfbb0b0..750f3053bf20ad61f450983091f2df76d4c1f6d5 100644
(file)
--- a/
src/language/lexer/lexer.c
+++ b/
src/language/lexer/lexer.c
@@
-104,8
+104,8
@@
static void dump_token (void);
void
lex_init (void)
{
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;
}
if (!lex_get_line ())
eof = true;
}
diff --git
a/src/language/line-buffer.c
b/src/language/line-buffer.c
index e451532082b06a9f88ac10ed8fcf0cf6ed289892..709bc2f0e9c85609aa8781ff26d7223e226e7e0d 100644
(file)
--- a/
src/language/line-buffer.c
+++ b/
src/language/line-buffer.c
@@
-111,7
+111,7
@@
getl_initialize (void)
{
ds_create (&getl_include_path,
fn_getenv_default ("STAT_INCLUDE_PATH", include_path));
{
ds_create (&getl_include_path,
fn_getenv_default ("STAT_INCLUDE_PATH", include_path));
- ds_init (&getl_buf
, 256
);
+ ds_init (&getl_buf);
init_prompts ();
}
init_prompts ();
}
diff --git
a/src/libpspp/ChangeLog
b/src/libpspp/ChangeLog
index 6e029143041d4448cca2f2f57ad2c71ed0ea12f5..305561195f927169b7bf9926a050ea3097954250 100644
(file)
--- a/
src/libpspp/ChangeLog
+++ b/
src/libpspp/ChangeLog
@@
-1,3
+1,8
@@
+Sun May 14 20:52:20 2006 Ben Pfaff <blp@gnu.org>
+
+ * 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 <blp@gnu.org>
* va_copy.h: Removed. Now use va_copy() provided by gnulib
Tue May 9 09:56:57 2006 Ben Pfaff <blp@gnu.org>
* va_copy.h: Removed. Now use va_copy() provided by gnulib
diff --git
a/src/libpspp/str.c
b/src/libpspp/str.c
index 70edaeede16c0ac5bdf871d620b690cbd7118d59..ef2be7d068479ee023b484386a9d53d537d30407 100644
(file)
--- a/
src/libpspp/str.c
+++ b/
src/libpspp/str.c
@@
-247,13
+247,13
@@
ds_create (struct string *st, const char *s)
strcpy (st->string, s);
}
strcpy (st->string, s);
}
-/* Initializes ST
, making room for at least CAPACITY characters
. */
+/* Initializes ST
as an empty string
. */
void
void
-ds_init (struct string *st
, size_t capacity
)
+ds_init (struct string *st)
{
st->length = 0;
{
st->length = 0;
- st->capacity =
MAX (8, capacity)
;
- st->string =
xmalloc (st->capacity + 1)
;
+ st->capacity =
0
;
+ st->string =
NULL
;
}
/* Frees ST. */
}
/* Frees ST. */
@@
-285,7
+285,7
@@
ds_init_substring (struct string *dst,
const struct string *src, size_t idx, size_t cnt)
{
assert (dst != src);
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);
}
ds_assign_substring (dst, src, idx, cnt);
}
diff --git
a/src/libpspp/str.h
b/src/libpspp/str.h
index aa93fb2b7b751bd0600e151d51f9b2ca8bfa6ba9..379762fc858e5db6171ace675007055b12b009e1 100644
(file)
--- a/
src/libpspp/str.h
+++ b/
src/libpspp/str.h
@@
-117,7
+117,7
@@
struct string
#define DS_INITIALIZER {NULL, 0, 0}
/* Constructors, destructors. */
#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 *);
void ds_init_substring (struct string *,
const struct string *src, size_t start, size_t cnt);
void ds_create (struct string *, const char *);
diff --git
a/src/output/afm.c
b/src/output/afm.c
index 8e6d6916517c050019ecbc3b3a49985ebd54483f..643ce87011c715cf786e4a455ee24f34958ac5dd 100644
(file)
--- a/
src/output/afm.c
+++ b/
src/output/afm.c
@@
-720,7
+720,7
@@
get_word (struct parser *p, char **word)
struct string s;
int c;
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);
while (!isspace (c = getc (p->file)) && c != EOF)
ds_putc (&s, c);
ungetc (c, p->file);
@@
-756,9
+756,8
@@
force_get_word (struct parser *p)
static bool
get_string (struct parser *p, char **string)
{
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 (;;)
{
skip_spaces (p);
for (;;)
{
diff --git
a/src/output/ascii.c
b/src/output/ascii.c
index 53610bdec1e81b00bf9de0fb8d35cd49a3faf094..8f960fe308b7ff9c017fa450ce249fcb064c0667 100644
(file)
--- a/
src/output/ascii.c
+++ b/
src/output/ascii.c
@@
-672,7
+672,7
@@
ascii_close_page (struct outp_driver *this)
struct string out;
int line_num;
struct string out;
int line_num;
- ds_init (&out
, 128
);
+ ds_init (&out);
ds_putc_multiple (&out, '\n', x->top_margin);
if (x->headers)
ds_putc_multiple (&out, '\n', x->top_margin);
if (x->headers)
diff --git
a/src/output/output.c
b/src/output/output.c
index ffaa7eb8c52d303247f96595cc426c77375de19f..19761e7532079831b9a3fdd8b591e1d95e37acdb 100644
(file)
--- a/
src/output/output.c
+++ b/
src/output/output.c
@@
-286,7
+286,7
@@
outp_read_devices (void)
config_path),
NULL);
config_path),
NULL);
- ds_init (&line
, 128
);
+ ds_init (&line);
if (init_fn == NULL)
{
if (init_fn == NULL)
{
@@
-767,7
+767,7
@@
configure_driver_line (struct string *line)
for (i = 0; i < 4; i++)
{
struct string *token = &tokens[i];
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);
}
ds_separate (line, token, i < 3 ? ":" : "", &save_idx);
ds_trim_spaces (token);
}
@@
-1032,7
+1032,7
@@
outp_get_paper_size (char *size, int *h, int *v)
config_path),
NULL);
config_path),
NULL);
- ds_init (&line
, 128
);
+ ds_init (&line);
if (pprsz_fn == NULL)
{
if (pprsz_fn == NULL)
{
diff --git
a/src/output/postscript.c
b/src/output/postscript.c
index f212bb20084c639bf00fc2306c233dc501adf9af..919d1bb7debd31de3f6f5338fbbedc9db2c638c0 100644
(file)
--- a/
src/output/postscript.c
+++ b/
src/output/postscript.c
@@
-874,7
+874,7
@@
write_text (struct outp_driver *this,
fprintf (ext->file, "F%d setfont\n", font);
}
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++)
for (i = 0; i < char_cnt; i = j)
{
for (j = i + 1; j < char_cnt; j++)
@@
-1382,7
+1382,7
@@
reencode_font (struct outp_driver *this, struct font *font)
line_number = 0;
line_number = 0;
- ds_init (&line
, 0
);
+ ds_init (&line);
while (ds_get_config_line (file, &line, &line_number))
{
char *pschar, *code;
while (ds_get_config_line (file, &line, &line_number))
{
char *pschar, *code;