summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0cf1e02)
raw | patch | inline | side by side (parent: 0cf1e02)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 22 Aug 2014 06:06:04 +0000 (23:06 -0700) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 22 Aug 2014 06:06:04 +0000 (23:06 -0700) |
Also, fixed various (mostly minor) issues identified this way.
index 6888e39d39730c77589cbe046971243c9ce08f0f..ce16a8b900085ecbac3eb5ef82b4af466400dcca 100644 (file)
return -1;
/* reset */
- sdb_strbuf_sprintf(conn->errbuf, "");
+ sdb_strbuf_clear(conn->errbuf);
conn->cmd = connection_get_int32(conn, 0);
conn->cmd_len = connection_get_int32(conn, sizeof(uint32_t));
if (errmsg) {
size_t len = sdb_strbuf_len(conn->buf);
- sdb_strbuf_sprintf(conn->errbuf, errmsg);
+ sdb_strbuf_sprintf(conn->errbuf, "%s", errmsg);
sdb_connection_send(conn, CONNECTION_ERROR,
(uint32_t)strlen(errmsg), errmsg);
conn->skip_len += conn->cmd_len;
diff --git a/src/frontend/query.c b/src/frontend/query.c
index e0b7181161cde74bbf9ba50d96c49022444ec31e..bbf98530afedcb106abc34174e9c61e9dc8a55ae 100644 (file)
--- a/src/frontend/query.c
+++ b/src/frontend/query.c
char query[conn->cmd_len + 1];
strncpy(query, sdb_strbuf_string(conn->buf), conn->cmd_len);
query[sizeof(query) - 1] = '\0';
- sdb_log(SDB_LOG_WARNING, "frontend: Ignoring %d command%s "
+ sdb_log(SDB_LOG_WARNING, "frontend: Ignoring %zu command%s "
"in multi-statement query '%s'",
sdb_llist_len(parsetree) - 1,
sdb_llist_len(parsetree) == 2 ? "" : "s",
diff --git a/src/frontend/sock.c b/src/frontend/sock.c
index dd0afa907fbcf5564a05d187db28d9eca3c0ea0b..96bc04baf805640b747f46861d181ec0177e4e4b 100644 (file)
--- a/src/frontend/sock.c
+++ b/src/frontend/sock.c
return -1;
}
- sdb_log(SDB_LOG_INFO, "frontend: Starting %d connection "
- "handler thread%s managing %d listener%s",
+ sdb_log(SDB_LOG_INFO, "frontend: Starting %zu connection "
+ "handler thread%s managing %zu listener%s",
loop->num_threads, loop->num_threads == 1 ? "" : "s",
sock->listeners_num, sock->listeners_num == 1 ? "" : "s");
index 0dce87705fb5cb5793c2b7500fd774dae18ec910..4e5d1046660896bb91bb5759309fda23da448758 100644 (file)
* Log a formatted message. See sdb_plugin_log for more information.
*/
int
-sdb_plugin_vlogf(int prio, const char *fmt, va_list ap);
+sdb_plugin_vlogf(int prio, const char *fmt, va_list ap)
+ __attribute__((format(printf, 2, 0)));
int
-sdb_plugin_logf(int prio, const char *fmt, ...);
+sdb_plugin_logf(int prio, const char *fmt, ...)
+ __attribute__((format(printf, 2, 3)));
/*
* sdb_plugin_fetch_timeseries:
index c97e121ad7d4dddc0d243b421e597a434b1fedd0..c48a2e1329b6bb8371507fa382dcf90601591a18 100644 (file)
--- a/src/include/core/time.h
+++ b/src/include/core/time.h
sdb_sleep(sdb_time_t reg, sdb_time_t *rem);
size_t
-sdb_strftime(char *s, size_t len, const char *format, sdb_time_t);
+sdb_strftime(char *s, size_t len, const char *format, sdb_time_t)
+ __attribute__((format(strftime, 3, 0)));
size_t
sdb_strfinterval(char *s, size_t len, sdb_time_t interval);
index b9256bb9a0a9422e223b17f869c83721f9a42a19..2c3df32ff48a98c2fe7f26e03fe1593c55acbb82 100644 (file)
* on configuration, try a clean shut-down of the process.
*/
int
-sdb_log(int prio, const char *fmt, ...);
+sdb_log(int prio, const char *fmt, ...)
+ __attribute__((format(printf, 2, 3)));
/*
* sdb_error_set, sdb_error_append:
* be done.
*/
int
-sdb_error_set(const char *fmt, ...);
+sdb_error_set(const char *fmt, ...)
+ __attribute__((format(printf, 1, 2)));
int
-sdb_error_append(const char *fmt, ...);
+sdb_error_append(const char *fmt, ...)
+ __attribute__((format(printf, 1, 2)));
/*
* sdb_error_chomp:
index 20cf8706b53038165e73d7892401eb8066e94b59..5e9913d1d6217a8753ebc131933ab0c93910f38c 100644 (file)
* - a negative value on error
*/
ssize_t
-sdb_strbuf_vappend(sdb_strbuf_t *strbuf, const char *fmt, va_list ap);
+sdb_strbuf_vappend(sdb_strbuf_t *strbuf, const char *fmt, va_list ap)
+ __attribute__((format(printf, 2, 0)));
ssize_t
-sdb_strbuf_append(sdb_strbuf_t *strbuf, const char *fmt, ...);
+sdb_strbuf_append(sdb_strbuf_t *strbuf, const char *fmt, ...)
+ __attribute__((format(printf, 2, 3)));
/*
* sdb_strbuf_vsprintf, sdb_strbuf_sprintf:
* - a negative value on error
*/
ssize_t
-sdb_strbuf_vsprintf(sdb_strbuf_t *strbuf, const char *fmt, va_list ap);
+sdb_strbuf_vsprintf(sdb_strbuf_t *strbuf, const char *fmt, va_list ap)
+ __attribute__((format(printf, 2, 0)));
ssize_t
-sdb_strbuf_sprintf(sdb_strbuf_t *strbuf, const char *fmt, ...);
+sdb_strbuf_sprintf(sdb_strbuf_t *strbuf, const char *fmt, ...)
+ __attribute__((format(printf, 2, 3)));
/*
* sdb_strbuf_memcpy, sdb_strbuf_memappend:
index 21a2e5d3112fe2b2da323ea2af782e8b95cb2626..55a074cd3863f8a39fa947a7f96cba2d8822488f 100644 (file)
--- a/src/tools/sysdb/input.c
+++ b/src/tools/sysdb/input.c
return;
}
- sdb_strbuf_append(sysdb_input->input, line);
- sdb_strbuf_append(sysdb_input->input, "\n");
+ sdb_strbuf_append(sysdb_input->input, "%s\n", line);
free(line);
if (sysdb_input->interactive)
index b0159c4d7406cc4e44cd0812c8ae03bfd06c1e72..e7cb9f5a6438cfb9ba1cc30ed90835ab5dbcaeb1 100644 (file)
size_t i;
for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) {
- n = sdb_strbuf_append(buf, golden_data[i].input);
+ n = sdb_strbuf_append(buf, "%s", golden_data[i].input);
fail_unless((size_t)n == strlen(golden_data[i].input),
"sdb_strbuf_append() appended %zi bytes; expected: %zu",
n, strlen(golden_data[i].input));
test, golden_data[i].result);
}
- n = sdb_strbuf_append(buf, "%zu; %5.4f", 42, 4.2);
+ n = sdb_strbuf_append(buf, "%zu; %5.4f", (size_t)42, 4.2);
fail_unless(n == 10,
"sdb_strbuf_append() appended %zi bytes; expected: 10", n);
total += n;
size_t i;
for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) {
- n = sdb_strbuf_sprintf(buf, golden_data[i]);
+ n = sdb_strbuf_sprintf(buf, "%s", golden_data[i]);
fail_unless((size_t)n == strlen(golden_data[i]),
"sdb_strbuf_sprintf() wrote %zi bytes; expected: %zu",
n, strlen(golden_data[i]));
check, n, n / 3);
}
- n = sdb_strbuf_sprintf(buf, "%zu; %5.4f", 42, 4.2);
+ n = sdb_strbuf_sprintf(buf, "%zu; %5.4f", (size_t)42, 4.2);
fail_unless(n == 10,
"sdb_strbuf_sprintf() wrote %zi bytes; expected: 10", n);
check = sdb_strbuf_len(buf);
const char *check;
if (golden_data[i].input)
- sdb_strbuf_sprintf(buf, golden_data[i].input);
+ sdb_strbuf_sprintf(buf, "%s", golden_data[i].input);
/* empty buffer */
n = sdb_strbuf_chomp(buf);
const char *check;
size_t n;
- sdb_strbuf_sprintf(buf, input);
+ sdb_strbuf_sprintf(buf, "%s", input);
sdb_strbuf_skip(buf, golden_data[i].offset,
golden_data[i].n);
const char *check;
if (golden_data[i].input)
- sdb_strbuf_sprintf(buf, golden_data[i].input);
+ sdb_strbuf_sprintf(buf, "%s", golden_data[i].input);
check = sdb_strbuf_string(buf);
fail_unless(!strcmp(check, golden_data[i].expected),
"sdb_strbuf_string() = '%s'; expected: '%s'",
size_t check;
if (golden_data[i].input)
- sdb_strbuf_sprintf(buf, golden_data[i].input);
+ sdb_strbuf_sprintf(buf, "%s", golden_data[i].input);
check = sdb_strbuf_len(buf);
fail_unless(check == golden_data[i].expected,
"sdb_strbuf_len() = %zu; expected: %zu",