summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@intec.ugent.be>2016-04-02 17:39:32 +0200
committerDimitri Staessens <dimitri.staessens@intec.ugent.be>2016-04-02 17:39:32 +0200
commitaffea724d1810410186b10c93c64b7a8ddbe7aca (patch)
treeae605f8c39bd4092233175de34b6d0b2f16481f4 /src/lib
parent02972a88ac293356bcb4b03c8c6cd79735f7288a (diff)
parent9fed4c5bdb4928c7f5c73e85888de54672cd4c56 (diff)
downloadouroboros-affea724d1810410186b10c93c64b7a8ddbe7aca.tar.gz
ouroboros-affea724d1810410186b10c93c64b7a8ddbe7aca.zip
Merged in sandervrijders/ouroboros/be (pull request #52)
Strdup changes
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/instance_name.c21
-rw-r--r--src/lib/utils.c22
2 files changed, 22 insertions, 21 deletions
diff --git a/src/lib/instance_name.c b/src/lib/instance_name.c
index 0f666211..e560c0b9 100644
--- a/src/lib/instance_name.c
+++ b/src/lib/instance_name.c
@@ -31,27 +31,6 @@
#include <malloc.h>
#include <stdlib.h>
-#define instance_name_is_equal(a, b) (instance_name_cmp(a, b) == 0)
-
-static char * strdup(const char * src)
-{
- int len = 0;
- char * dst = NULL;
-
- if (src == NULL)
- return NULL;
-
- len = strlen(src) + 1;
-
- dst = malloc(len);
- if (dst == NULL)
- return NULL;
-
- memcpy(dst, src, len);
-
- return dst;
-}
-
instance_name_t * instance_name_create()
{
instance_name_t * tmp;
diff --git a/src/lib/utils.c b/src/lib/utils.c
index ca082642..77a2d44c 100644
--- a/src/lib/utils.c
+++ b/src/lib/utils.c
@@ -20,6 +20,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <stdlib.h>
+#include <string.h>
+
int n_digits(unsigned i)
{
int n = 1;
@@ -31,3 +34,22 @@ int n_digits(unsigned i)
return n;
}
+
+char * strdup(const char * src)
+{
+ int len = 0;
+ char * dst = NULL;
+
+ if (src == NULL)
+ return NULL;
+
+ len = strlen(src) + 1;
+
+ dst = malloc(len);
+ if (dst == NULL)
+ return NULL;
+
+ memcpy(dst, src, len);
+
+ return dst;
+}