summaryrefslogtreecommitdiff
path: root/src/mod_vhostdb_dbi.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-10-13 04:59:57 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2020-02-24 11:15:32 -0500
commit601c572c3924be5e69a122bce81a9b57a7f985ae (patch)
tree554cd4465d74aa3163848d714930568c46721937 /src/mod_vhostdb_dbi.c
parentb7942c58cc6c028754340c9f8ded0f6cd1b43363 (diff)
downloadlighttpd-git-601c572c3924be5e69a122bce81a9b57a7f985ae.tar.gz
[core] inline buffer as part of data_string value
(instead of value being (buffer *))
Diffstat (limited to 'src/mod_vhostdb_dbi.c')
-rw-r--r--src/mod_vhostdb_dbi.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mod_vhostdb_dbi.c b/src/mod_vhostdb_dbi.c
index aae4f2b0..d7f04a18 100644
--- a/src/mod_vhostdb_dbi.c
+++ b/src/mod_vhostdb_dbi.c
@@ -24,7 +24,7 @@
typedef struct {
dbi_conn dbconn;
dbi_inst dbinst;
- buffer *sqlquery;
+ const buffer *sqlquery;
server *srv;
short reconnect_count;
} vhostdb_config;
@@ -70,18 +70,18 @@ static void mod_vhostdb_dbconf_free (void *vdata)
static int mod_vhostdb_dbconf_setup (server *srv, array *opts, void **vdata)
{
- buffer *sqlquery = NULL;
+ const buffer *sqlquery = NULL;
const buffer *dbtype=NULL, *dbname=NULL;
for (size_t i = 0; i < opts->used; ++i) {
const data_string *ds = (data_string *)opts->data[i];
if (ds->type == TYPE_STRING) {
if (buffer_is_equal_caseless_string(&ds->key, CONST_STR_LEN("sql"))) {
- sqlquery = ds->value;
+ sqlquery = &ds->value;
} else if (buffer_is_equal_caseless_string(&ds->key, CONST_STR_LEN("dbname"))) {
- dbname = ds->value;
+ dbname = &ds->value;
} else if (buffer_is_equal_caseless_string(&ds->key, CONST_STR_LEN("dbtype"))) {
- dbtype = ds->value;
+ dbtype = &ds->value;
}
}
}
@@ -131,8 +131,8 @@ static int mod_vhostdb_dbconf_setup (server *srv, array *opts, void **vdata)
dbi_conn_set_option_numeric(dbconn, opt->ptr, di->value);
} else if (du->type == TYPE_STRING) {
data_string *ds = (data_string *)du;
- if (ds->value != sqlquery && ds->value != dbtype) {
- dbi_conn_set_option(dbconn, opt->ptr, ds->value->ptr);
+ if (&ds->value != sqlquery && &ds->value != dbtype) {
+ dbi_conn_set_option(dbconn, opt->ptr, ds->value.ptr);
}
}
}