]> git.webhop.me Git - lcd4linux.git/commitdiff
use own strndup() from evaluator if not available on system
authorvolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 17 Jan 2010 14:40:03 +0000 (14:40 +0000)
committervolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 17 Jan 2010 14:40:03 +0000 (14:40 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1082 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

evaluator.h
plugin_i2c_sensors.c

index d969afe9fee3bf3ff97bf1a5e7b3ef343110109f..5de3ce1362ef10deac42239197d395be91b6f25d 100644 (file)
@@ -40,6 +40,11 @@ typedef struct {
     char *string;
 } RESULT;
 
+/* strndup() may be not available on several platforms */
+#ifndef HAVE_STRNDUP
+char *strndup(const char *source, size_t len);
+#endif
+
 int SetVariable(const char *name, RESULT * value);
 int SetVariableNumeric(const char *name, const double value);
 int SetVariableString(const char *name, const char *value);
index 47d080e62ff842561a15d27daf4e9ab88643c1e9..989f97c2c9e2ed6f94885cea517e23b237bbf7a9 100644 (file)
@@ -74,6 +74,7 @@
 #include "cfg.h"
 #include "hash.h"
 #include "qprintf.h"
+#include "evaluator.h"         // if strndup() is not available
 
 #ifdef WITH_DMALLOC
 #include <dmalloc.h>
@@ -188,12 +189,7 @@ static int parse_i2c_sensors_procfs(const char *key)
        return -1;
     }
 
-#ifndef __MAC_OS_X_VERSION_10_3
     running = strndup(buffer, sizeof(buffer));
-#else
-    // there is no strndup in OSX
-    running = strdup(buffer);
-#endif
     while (1) {
        value = strsep(&running, delim);
        /* debug("%s pos %i -> %s", file, pos , value); */