Browse Source

[multiple] remove buffer_init_string()

remove (minor) convenience func; easy to replace
master
Glenn Strauss 5 months ago
parent
commit
bade1c0319
  1. 6
      src/buffer.c
  2. 3
      src/buffer.h
  3. 3
      src/configfile.c
  4. 2
      src/configparser.y
  5. 3
      src/mod_authn_gssapi.c
  6. 6
      src/mod_cgi.c
  7. 6
      src/t/test_mod_userdir.c

6
src/buffer.c

@ -23,12 +23,6 @@ buffer *buffer_init_buffer(const buffer *src) {
return b;
}
buffer *buffer_init_string(const char *str) {
buffer * const b = buffer_init();
buffer_copy_string(b, str);
return b;
}
void buffer_free(buffer *b) {
if (NULL == b) return;

3
src/buffer.h

@ -37,9 +37,6 @@ __attribute_nonnull__()
__attribute_returns_nonnull__
buffer* buffer_init_buffer(const buffer *src);
__attribute_returns_nonnull__
buffer* buffer_init_string(const char *str); /* str can be NULL */
void buffer_free(buffer *b); /* b can be NULL */
/* reset b. if NULL != b && NULL != src, move src content to b. reset src. */

3
src/configfile.c

@ -2138,7 +2138,8 @@ static int config_parse(server *srv, config_t *context, const char *source, cons
if (ret != -1 && context->ok) {
/* add an EOL at EOF, better than say sorry */
configparser(pParser, TK_EOL, buffer_init_string("(EOL)"), context);
buffer_copy_string((token = buffer_init()), "(EOL)");
configparser(pParser, TK_EOL, token, context);
if (context->ok) {
configparser(pParser, 0, NULL, context);
}

2
src/configparser.y

@ -400,7 +400,7 @@ varline ::= key(A) APPEND expression(B). {
key(A) ::= LKEY(B). {
if (strchr(B->ptr, '.') == NULL) {
A = buffer_init_string("var.");
buffer_copy_string((A = buffer_init()), "var.");
buffer_append_string_buffer(A, B);
} else {
A = B;

3
src/mod_authn_gssapi.c

@ -161,11 +161,12 @@ static handler_t mod_authn_gssapi_send_400_bad_request (request_st * const r)
__attribute_cold__
static void mod_authn_gssapi_log_gss_error(log_error_st *errh, const char *file, unsigned int line, const char *func, const char *extra, OM_uint32 err_maj, OM_uint32 err_min)
{
buffer * const msg = buffer_init_string(func);
buffer * const msg = buffer_init();
OM_uint32 maj_stat, min_stat;
OM_uint32 msg_ctx = 0;
gss_buffer_desc status_string;
buffer_copy_string(msg, func);
buffer_append_string_len(msg, CONST_STR_LEN("("));
if (extra) buffer_append_string(msg, extra);
buffer_append_string_len(msg, CONST_STR_LEN("):"));

6
src/mod_cgi.c

@ -124,13 +124,13 @@ INIT_FUNC(mod_cgi_init) {
/* for valgrind */
s = getenv("LD_PRELOAD");
if (s) p->env.ld_preload = buffer_init_string(s);
if (s) buffer_copy_string((p->env.ld_preload = buffer_init()), s);
s = getenv("LD_LIBRARY_PATH");
if (s) p->env.ld_library_path = buffer_init_string(s);
if (s) buffer_copy_string((p->env.ld_library_path = buffer_init()), s);
#ifdef __CYGWIN__
/* CYGWIN needs SYSTEMROOT */
s = getenv("SYSTEMROOT");
if (s) p->env.systemroot = buffer_init_string(s);
if (s) buffer_copy_string((p->env.systemroot = buffer_init()), s);
#endif
return p;

6
src/t/test_mod_userdir.c

@ -159,8 +159,10 @@ void test_mod_userdir (void)
plugin_data * const p = mod_userdir_init();
assert(NULL != p);
buffer *basepath = buffer_init_string("/web/u/"); /*(skip getpwnam())*/
buffer *path = buffer_init_string("public_html");
buffer *basepath = buffer_init();
buffer *path = buffer_init();
buffer_copy_string(basepath, "/web/u/"); /*(skip getpwnam())*/
buffer_copy_string(path, "public_html");
p->defaults.basepath = basepath;
p->defaults.path = path;

Loading…
Cancel
Save