summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2009-09-25 13:14:35 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2009-09-25 13:14:35 +0200
commit3b79f0183dde8e2b2694dc26da836c75640d8c5d (patch)
treef323d6de64a4dc81ef8f4d6f8b80d5f136121d26 /common
parentea848bbd45b4ede131d1a3514844c22d50736645 (diff)
downloadeurephia-3b79f0183dde8e2b2694dc26da836c75640d8c5d.tar.gz
eurephia-3b79f0183dde8e2b2694dc26da836c75640d8c5d.tar.xz
eurephia-3b79f0183dde8e2b2694dc26da836c75640d8c5d.zip
Moved the useful append_str() macro from sqlite.c to eurephia_nullsafe.h
Diffstat (limited to 'common')
-rw-r--r--common/eurephia_nullsafe.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/eurephia_nullsafe.h b/common/eurephia_nullsafe.h
index 5f6b58c..22d50ed 100644
--- a/common/eurephia_nullsafe.h
+++ b/common/eurephia_nullsafe.h
@@ -59,6 +59,17 @@
/**
+ * Wrapper macro, which appends a string to a destination string without exceeding the size
+ * of the destination buffer.
+ *
+ * @param dest Pointer to the destination buffer
+ * @param src Pointer to the value being concatenated to the destination string.
+ * @param size Size of the destination buffer
+ */
+#define append_str(dest, src, size) strncat(dest, src, (size - strlen_nullsafe(dest)))
+
+
+/**
* strlen() wrapper. Returns the length of a string
*
* @param str Input string