summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 848efad)
raw | patch | inline | side by side (parent: 848efad)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 10 Mar 2013 21:12:07 +0000 (22:12 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 10 Mar 2013 21:12:07 +0000 (22:12 +0100) |
13 files changed:
src/Makefile.am | patch | blob | history | |
src/backend/collectd.c | patch | blob | history | |
src/backend/mk-livestatus.c | patch | blob | history | |
src/backend/puppet-storeconfigs.c | patch | blob | history | |
src/core/plugin.c | patch | blob | history | |
src/core/store.c | patch | blob | history | |
src/daemon/sysdbd.c | patch | blob | history | |
src/include/utils/error.h | patch | blob | history | |
src/include/utils/string.h | [deleted file] | patch | blob | history |
src/utils/error.c | patch | blob | history | |
src/utils/string.c | [deleted file] | patch | blob | history |
src/utils/time.c | patch | blob | history | |
src/utils/unixsock.c | patch | blob | history |
diff --git a/src/Makefile.am b/src/Makefile.am
index 9de8dd02b966108990b20f76f25785039870236c..8b438f60198367444fe3339850585b5b22fff691 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
include/core/plugin.h
pkgutilsincludedir = $(pkgincludedir)/utils
pkgutilsinclude_HEADERS = \
- include/utils/llist.h \
- include/utils/string.h
+ include/utils/llist.h
lib_LTLIBRARIES = libsysdb.la
include/utils/data.h \
utils/error.c include/utils/error.h \
utils/llist.c include/utils/llist.h \
- utils/string.c include/utils/string.h \
utils/time.c include/utils/time.h \
utils/unixsock.c include/utils/unixsock.h
libsysdb_la_CFLAGS = $(AM_CFLAGS)
diff --git a/src/backend/collectd.c b/src/backend/collectd.c
index 312d7acf553d79f93d982704d64df177df193b7a..2ace8e11b83a889f167123ba06dbc1b3857e86ee 100644 (file)
--- a/src/backend/collectd.c
+++ b/src/backend/collectd.c
#include "core/plugin.h"
#include "core/store.h"
#include "utils/error.h"
-#include "utils/string.h"
#include "utils/unixsock.h"
#include "liboconfig/utils.h"
index 5d8c37735e25cf30cf2e4772ca6757e84e1fe8d5..87c44deb7b920d56cc3c82542d17b4140f4899aa 100644 (file)
#include "core/plugin.h"
#include "core/store.h"
#include "utils/error.h"
-#include "utils/string.h"
#include "utils/unixsock.h"
#include "liboconfig/utils.h"
index d55b76477d33bfbc2aadf7f3ad2ff938eebeb44f..5549f777f07967e1b2129021463b6734e7474daa 100644 (file)
#include "core/store.h"
#include "utils/error.h"
#include "utils/dbi.h"
-#include "utils/string.h"
#include "liboconfig/utils.h"
diff --git a/src/core/plugin.c b/src/core/plugin.c
index 99f07cb03e2a10914f56fab553a4e56aad54eed6..306f5e902565d3a0b025ea8d08851672a4b53fbe 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
#include "core/plugin.h"
#include "utils/error.h"
#include "utils/llist.h"
-#include "utils/string.h"
#include "utils/time.h"
#include <assert.h>
diff --git a/src/core/store.c b/src/core/store.c
index 3901ba45a3016b5d8ca5f911cee64cc33b6db388..04968102713822e05174e0437682a542528855e0 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
#include "core/store.h"
#include "utils/error.h"
#include "utils/llist.h"
-#include "utils/string.h"
#include <assert.h>
diff --git a/src/daemon/sysdbd.c b/src/daemon/sysdbd.c
index 5a901a223bf432ad02b542bba11c1b2e32ea03a3..fa314909fef5ed26dbcc6ae6da783333ed08a684 100644 (file)
--- a/src/daemon/sysdbd.c
+++ b/src/daemon/sysdbd.c
#include "core/plugin.h"
#include "core/store.h"
#include "utils/error.h"
-#include "utils/string.h"
#include "daemon/config.h"
index 73b48baacf2c1cdf9f5df66118166fc90c6df408..487b6e4ffcaa98dffd1202e5667c102fdfcd960e 100644 (file)
#ifndef SDB_UTILS_ERROR_H
#define SDB_UTILS_ERROR_H 1
+#include <stddef.h>
+
#ifdef __cplusplus
extern "C" {
#endif
int
sdb_error_get_prio(void);
+/*
+ * sdb_strerror:
+ * This is a wrapper around the system's strerror function which ensures that
+ * a pointer to the formatted error message is returned.
+ */
+char *
+sdb_strerror(int errnum, char *strerrbuf, size_t buflen);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/include/utils/string.h b/src/include/utils/string.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SysDB - src/include/utils/string.h
- * Copyright (C) 2012 Sebastian 'tokkee' Harl <sh@tokkee.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SDB_UTILS_STRING_H
-#define SDB_UTILS_STRING_H 1
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-char *
-sdb_strerror(int errnum, char *strerrbuf, size_t buflen);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* ! SDB_UTILS_STRING_H */
-
-/* vim: set tw=78 sw=4 ts=4 noexpandtab : */
-
diff --git a/src/utils/error.c b/src/utils/error.c
index 7eef71263d70b695945da5671e55d0e632a05377..6bb17d5821f5ea68259606cbc6bcd8312d55b04e 100644 (file)
--- a/src/utils/error.c
+++ b/src/utils/error.c
return ctx->prio;
} /* sdb_error_get_prio */
+char *
+sdb_strerror(int errnum, char *strerrbuf, size_t buflen)
+{
+#if STRERROR_R_CHAR_P
+ {
+ char *tmp = strerror_r(errnum, strerrbuf, buflen);
+ if (*strerrbuf = '\0') {
+ if (tmp && (tmp != strerrbuf) && (*tmp != '\0'))
+ strncpy(strerrbuf, tmp, buflen);
+ else
+ snprintf(strerrbuf, buflen, "unknown error #%i "
+ "(strerror_r(3) did not return an error message)",
+ errnum);
+ }
+ }
+#else
+ if (strerror_r(errnum, strerrbuf, buflen))
+ snprintf(strerrbuf, buflen, "unknown error #%i "
+ "(strerror_r(3) failed)", errnum);
+#endif
+
+ strerrbuf[buflen - 1] = '\0';
+ return strerrbuf;
+} /* sdb_strerror */
+
/* vim: set tw=78 sw=4 ts=4 noexpandtab : */
diff --git a/src/utils/string.c b/src/utils/string.c
--- a/src/utils/string.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SysDB - src/utils/string.c
- * Copyright (C) 2012 Sebastian 'tokkee' Harl <sh@tokkee.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "utils/string.h"
-
-#include <stdio.h>
-#include <string.h>
-
-/*
- * public API
- */
-
-char *
-sdb_strerror(int errnum, char *strerrbuf, size_t buflen)
-{
-#if STRERROR_R_CHAR_P
- {
- char *tmp = strerror_r(errnum, strerrbuf, buflen);
- if (*strerrbuf = '\0') {
- if (tmp && (tmp != strerrbuf) && (*tmp != '\0'))
- strncpy(strerrbuf, tmp, buflen);
- else
- snprintf(strerrbuf, buflen, "unknown error #%i "
- "(strerror_r(3) did not return an error message)",
- errnum);
- }
- }
-#else
- if (strerror_r(errnum, strerrbuf, buflen))
- snprintf(strerrbuf, buflen, "unknown error #%i "
- "(strerror_r(3) failed)", errnum);
-#endif
-
- strerrbuf[buflen - 1] = '\0';
- return strerrbuf;
-} /* sdb_strerror */
-
-/* vim: set tw=78 sw=4 ts=4 noexpandtab : */
-
diff --git a/src/utils/time.c b/src/utils/time.c
index e3aa5c1441d84cdcfc002a6c7703081bef39af6d..48232054bee89988fc4eb06ac2342c7e33dba895 100644 (file)
--- a/src/utils/time.c
+++ b/src/utils/time.c
*/
#include "utils/time.h"
-#include "utils/string.h"
#include <time.h>
diff --git a/src/utils/unixsock.c b/src/utils/unixsock.c
index 08233f8fb23f757a987422e73cd99f5d3dd58817..bc9806cfad8b367ef3af2d0170ab4a3c3f5e4774 100644 (file)
--- a/src/utils/unixsock.c
+++ b/src/utils/unixsock.c
#include "utils/unixsock.h"
#include "utils/error.h"
-#include "utils/string.h"
#include <assert.h>
#include <errno.h>