summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f257d14)
raw | patch | inline | side by side (parent: f257d14)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 15 Oct 2014 13:15:25 +0000 (15:15 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 15 Oct 2014 13:15:25 +0000 (15:15 +0200) |
src/core/data.c | patch | blob | history | |
src/include/core/data.h | patch | blob | history |
diff --git a/src/core/data.c b/src/core/data.c
index 4e52133484b8e219cdef562a86a7a9991bc2279e..a796b21eef37a57c4cc422836f5386f5c11c14ba 100644 (file)
--- a/src/core/data.c
+++ b/src/core/data.c
tmp.data.re.raw = strdup(str);
if (! tmp.data.re.raw)
return -1;
- if (regcomp(&tmp.data.re.regex, str,
+ if (regcomp(&tmp.data.re.regex, tmp.data.re.raw,
REG_EXTENDED | REG_ICASE | REG_NOSUB)) {
free(tmp.data.re.raw);
sdb_log(SDB_LOG_ERR, "core: Failed to compile regular "
- "expression '%s'", str);
+ "expression '%s'", tmp.data.re.raw);
return -1;
}
if (! data) {
index f1c0324a1e6b7cd9d736255ec25917b3bfa2325f..ffddf979f5509593417c80d6b3358b0b75e27a34 100644 (file)
--- a/src/include/core/data.h
+++ b/src/include/core/data.h
@@ -239,6 +239,11 @@ sdb_data_format(const sdb_data_t *datum, char *buf, size_t buflen, int quoted);
* memory and also compiled to a regex. Use sdb_data_free_datum() to free the
* dynamically allocated memory.
*
+ * The input string may be stored in 'data', that is, the function may be used
+ * to do an inline cast from a string to any other type. It is the callers
+ * responsibility to free the memory used by the string in case the target
+ * type does not keep a reference to it.
+ *
* Returns:
* - 0 on success
* - a negative value else