diff options
Diffstat (limited to 'src/sql.c')
-rw-r--r-- | src/sql.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -21,25 +21,25 @@ | |||
21 | struct sql_list | 21 | struct sql_list |
22 | { | 22 | { |
23 | struct sql_list *next; | 23 | struct sql_list *next; |
24 | struct sqlconn conn; | 24 | struct sqlconn conn; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | static struct sql_list *sql_list; | 27 | static struct sql_list *sql_list; |
28 | 28 | ||
29 | /* Append CONN to the end of sql_list */ | 29 | /* Append CONN to the end of sql_list */ |
30 | void | 30 | void |
31 | sql_register_conn (struct sqlconn *conn) | 31 | sql_register_conn (struct sqlconn *conn) |
32 | { | 32 | { |
33 | struct sql_list *ent = xmalloc (sizeof *ent); | 33 | struct sql_list *ent = grecs_malloc (sizeof *ent); |
34 | ent->conn = *conn; | 34 | ent->conn = *conn; |
35 | ent->next = sql_list; | 35 | ent->next = sql_list; |
36 | sql_list = ent; | 36 | sql_list = ent; |
37 | } | 37 | } |
38 | 38 | ||
39 | /* Find a configured connection that has the given IDENT */ | 39 | /* Find a configured connection that has the given IDENT */ |
40 | struct sqlconn * | 40 | struct sqlconn * |
41 | sql_find_connection (const char *ident) | 41 | sql_find_connection (const char *ident) |
42 | { | 42 | { |
43 | struct sql_list *p; | 43 | struct sql_list *p; |
44 | for (p = sql_list; p; p = p->next) | 44 | for (p = sql_list; p; p = p->next) |
45 | if (strcmp (p->conn.ident, ident) == 0) | 45 | if (strcmp (p->conn.ident, ident) == 0) |
@@ -189,19 +189,19 @@ sql_get_dictionary (struct dictionary *dict, void *handle, | |||
189 | } | 189 | } |
190 | 190 | ||
191 | int | 191 | int |
192 | sql_quote (struct dictionary *dict, void *handle, const char *input, | 192 | sql_quote (struct dictionary *dict, void *handle, const char *input, |
193 | char **poutput, size_t *psize) | 193 | char **poutput, size_t *psize) |
194 | { | 194 | { |
195 | struct sqlconn *conn = handle; | 195 | struct sqlconn *conn = handle; |
196 | size_t len, size; | 196 | size_t len, size; |
197 | char *output; | 197 | char *output; |
198 | 198 | ||
199 | len = strlen (input); | 199 | len = strlen (input); |
200 | size = 2 * len + 1; | 200 | size = 2 * len + 1; |
201 | output = xmalloc (size); | 201 | output = grecs_malloc (size); |
202 | mysql_real_escape_string (&conn->mysql, output, input, len); | 202 | mysql_real_escape_string (&conn->mysql, output, input, len); |
203 | *poutput = output; | 203 | *poutput = output; |
204 | if (psize) | 204 | if (psize) |
205 | *psize = strlen (output); | 205 | *psize = strlen (output); |
206 | return 0; | 206 | return 0; |
207 | } | 207 | } |