diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-11 12:13:09 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-11 12:13:09 +0300 |
commit | 590e208c40797206fd6a93651fc59e0b68eeb545 (patch) | |
tree | d7abd0ca33b3355b1a27760bf9850e445fafd607 /src/wydawca.h | |
parent | db81e378576dcc5510032c72060e48e562f208c9 (diff) | |
download | wydawca-590e208c40797206fd6a93651fc59e0b68eeb545.tar.gz wydawca-590e208c40797206fd6a93651fc59e0b68eeb545.tar.bz2 |
Remove obstack.
* src/txtacc.c: New file.
* gnulib.modules: Remove obstack.
* src/wydawca.h (txtacc_create, txtacc_free)
(txtacc_free_string, txtacc_grow)
(txtacc_finish): New functions.
(txtacc_1grow): New macro.
Diffstat (limited to 'src/wydawca.h')
-rw-r--r-- | src/wydawca.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/wydawca.h b/src/wydawca.h index 8d5dd34..ef1ff86 100644 --- a/src/wydawca.h +++ b/src/wydawca.h @@ -43,15 +43,12 @@ #include <sysexits.h> #include <mailutils/types.h> #include <mailutils/url.h> #include <mailutils/errno.h> -#define obstack_chunk_alloc malloc -#define obstack_chunk_free free -#include "obstack.h" #include "error.h" #include "xalloc.h" #include "backupfile.h" #include "grecs.h" #include "wordsplit.h" @@ -169,13 +166,13 @@ struct file_triplet const struct spool *spool; /* Owning spool */ char *relative_dir; /* Directory relative to spool->dest_dir */ char **directive; /* Decoded directive pairs (key: value\0) */ char *blurb; /* Block of directives: directive[i] points here */ char *tmp; /* Temporary storage */ size_t tmpsize; /* Size of memory allocated in tmp */ - struct obstack obstk; /* Obstack for string allocation */ + struct txtacc *acc; /* Text accumulator for string allocation */ /* User data */ size_t uploader_count; struct uploader_info *uploader_list; struct uploader_info *uploader; /* Special data for template formatting */ char *project; /* Triplet project name (if known) */ @@ -555,6 +552,19 @@ int tcpwrap_access(int fd); /* userprivs.c */ int wydawca_userprivs (uid_t uid, gid_t gid, gid_t *grplist, size_t ngrp); int push_dir (const char *dirname); int pop_dir (void); char *getcwd_alloc (void); + +struct txtacc *txtacc_create (void); +void txtacc_free (struct txtacc *acc); +void txtacc_free_string (struct txtacc *acc, char *str); +void txtacc_grow (struct txtacc *acc, const char *buf, size_t size); +#define txtacc_1grow(acc, c) \ + do \ + { \ + char __ch = c; \ + txtacc_grow (acc, &__ch, 1); \ + } \ + while (0) +char *txtacc_finish (struct txtacc *acc); |