Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

oracle plugin: Replace the o_config_set_string() function.

  • Loading branch information...
commit 96bcc111fd93a71f8dfeecc3fcd76bc72a135e57 1 parent fb064ef
@octo octo authored
Showing with 5 additions and 32 deletions.
  1. +5 −32 src/oracle.c
View
37 src/oracle.c
@@ -176,33 +176,6 @@ static void o_database_free (o_database_t *db) /* {{{ */
* </Plugin>
*/
-static int o_config_set_string (char **ret_string, /* {{{ */
- oconfig_item_t *ci)
-{
- char *string;
-
- if ((ci->values_num != 1)
- || (ci->values[0].type != OCONFIG_TYPE_STRING))
- {
- WARNING ("oracle plugin: The `%s' config option "
- "needs exactly one string argument.", ci->key);
- return (-1);
- }
-
- string = strdup (ci->values[0].value.string);
- if (string == NULL)
- {
- ERROR ("oracle plugin: strdup failed.");
- return (-1);
- }
-
- if (*ret_string != NULL)
- free (*ret_string);
- *ret_string = string;
-
- return (0);
-} /* }}} int o_config_set_string */
-
static int o_config_add_database (oconfig_item_t *ci) /* {{{ */
{
o_database_t *db;
@@ -230,7 +203,7 @@ static int o_config_add_database (oconfig_item_t *ci) /* {{{ */
db->username = NULL;
db->password = NULL;
- status = o_config_set_string (&db->name, ci);
+ status = cf_util_get_string (ci, &db->name);
if (status != 0)
{
sfree (db);
@@ -243,13 +216,13 @@ static int o_config_add_database (oconfig_item_t *ci) /* {{{ */
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("ConnectID", child->key) == 0)
- status = o_config_set_string (&db->connect_id, child);
+ status = cf_util_get_string (child, &db->connect_id);
else if (strcasecmp ("Host", child->key) == 0)
- status = o_config_set_string (&db->host, child);
+ status = cf_util_get_string (child, &db->host);
else if (strcasecmp ("Username", child->key) == 0)
- status = o_config_set_string (&db->username, child);
+ status = cf_util_get_string (child, &db->username);
else if (strcasecmp ("Password", child->key) == 0)
- status = o_config_set_string (&db->password, child);
+ status = cf_util_get_string (child, &db->password);
else if (strcasecmp ("Query", child->key) == 0)
status = udb_query_pick_from_list (child, queries, queries_num,
&db->queries, &db->queries_num);
Please sign in to comment.
Something went wrong with that request. Please try again.