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
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);
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;
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);
struct string s;
size_t i;
- ds_init (&s, 0);
+ ds_init (&s);
for (i = 0; i < word_cnt; i++)
{
if (i != 0)
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)))
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 ())
d->cp_y += d->font_height;
}
- ds_init(&line_buffer, largest_page_width + 2);
+ ds_init (&line_buffer);
}
/* Writes case C to output. */
struct string s;
const struct operation *f;
- ds_init (&s, 128);
+ ds_init (&s);
if (last - first == 1)
{
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;
}
{
ds_create (&getl_include_path,
fn_getenv_default ("STAT_INCLUDE_PATH", include_path));
- ds_init (&getl_buf, 256);
+ ds_init (&getl_buf);
init_prompts ();
}
+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
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. */
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);
}
#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 *);
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);
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 (;;)
{
struct string out;
int line_num;
- ds_init (&out, 128);
+ ds_init (&out);
ds_putc_multiple (&out, '\n', x->top_margin);
if (x->headers)
config_path),
NULL);
- ds_init (&line, 128);
+ ds_init (&line);
if (init_fn == NULL)
{
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);
}
config_path),
NULL);
- ds_init (&line, 128);
+ ds_init (&line);
if (pprsz_fn == NULL)
{
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++)
line_number = 0;
- ds_init (&line, 0);
+ ds_init (&line);
while (ds_get_config_line (file, &line, &line_number))
{
char *pschar, *code;