Lines Matching defs:dgs
3745 d_growable_string_init (struct d_growable_string *dgs, size_t estimate)
3747 dgs->buf = NULL;
3748 dgs->len = 0;
3749 dgs->alc = 0;
3750 dgs->allocation_failure = 0;
3753 d_growable_string_resize (dgs, estimate);
3759 d_growable_string_resize (struct d_growable_string *dgs, size_t need)
3764 if (dgs->allocation_failure)
3770 newalc = dgs->alc > 0 ? dgs->alc : 2;
3774 newbuf = (char *) realloc (dgs->buf, newalc);
3777 free (dgs->buf);
3778 dgs->buf = NULL;
3779 dgs->len = 0;
3780 dgs->alc = 0;
3781 dgs->allocation_failure = 1;
3784 dgs->buf = newbuf;
3785 dgs->alc = newalc;
3791 d_growable_string_append_buffer (struct d_growable_string *dgs,
3796 need = dgs->len + l + 1;
3797 if (need > dgs->alc)
3798 d_growable_string_resize (dgs, need);
3800 if (dgs->allocation_failure)
3803 memcpy (dgs->buf + dgs->len, s, l);
3804 dgs->buf[dgs->len + l] = '\0';
3805 dgs->len += l;
3813 struct d_growable_string *dgs = (struct d_growable_string*) opaque;
3815 d_growable_string_append_buffer (dgs, s, l);
4107 struct d_growable_string dgs;
4109 d_growable_string_init (&dgs, estimate);
4113 &dgs))
4115 free (dgs.buf);
4120 *palc = dgs.allocation_failure ? 1 : dgs.alc;
4121 return dgs.buf;
5929 struct d_growable_string dgs;
5932 d_growable_string_init (&dgs, 0);
5935 d_growable_string_callback_adapter, &dgs);
5938 free (dgs.buf);
5943 *palc = dgs.allocation_failure ? 1 : dgs.alc;
5944 return dgs.buf;