changeset 464:35d67bd0613b

Move str_*() functions to util.c
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 26 May 2012 06:01:06 +0300
parents 6c990eae11b2
children c3b3b6d89084
files main.c util.c util.h
diffstat 3 files changed, 35 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Sat May 26 06:00:02 2012 +0300
+++ b/main.c	Sat May 26 06:01:06 2012 +0300
@@ -209,36 +209,6 @@
 }
 
 
-BOOL str_get_timestamp(char *str, size_t len, const char *fmt)
-{
-    time_t stamp = time(NULL);
-    struct tm *stamp_tm;
-    if ((stamp_tm = localtime(&stamp)) != NULL)
-    {
-        strftime(str, len, fmt, stamp_tm);
-        return TRUE;
-    }
-    else
-    {
-        str[0] = 0;
-        return FALSE;
-    }
-}
-
-
-char * str_trim_left(char *buf)
-{
-    while (*buf != 0 && th_isspace(*buf)) buf++;
-    return buf;
-}
-
-
-int str_compare(const void *s1, const void *s2)
-{
-    return th_strcasecmp((const char *) s1, (const char *) s2);
-}
-
-
 nn_window_t *nnwin_find(const char *id)
 {
     int i;
--- a/util.c	Sat May 26 06:00:02 2012 +0300
+++ b/util.c	Sat May 26 06:01:06 2012 +0300
@@ -6,6 +6,36 @@
 #include "util.h"
 
 
+BOOL str_get_timestamp(char *str, size_t len, const char *fmt)
+{
+    time_t stamp = time(NULL);
+    struct tm *stamp_tm;
+    if ((stamp_tm = localtime(&stamp)) != NULL)
+    {
+        strftime(str, len, fmt, stamp_tm);
+        return TRUE;
+    }
+    else
+    {
+        str[0] = 0;
+        return FALSE;
+    }
+}
+
+
+char * str_trim_left(char *buf)
+{
+    while (*buf != 0 && th_isspace(*buf)) buf++;
+    return buf;
+}
+
+
+int str_compare(const void *s1, const void *s2)
+{
+    return th_strcasecmp((const char *) s1, (const char *) s2);
+}
+
+
 #define PUSHCHAR(x) th_vputch(&result, &resSize, &resPos, x)
 #define PUSHSTR(x) th_vputs(&result, &resSize, &resPos, x)
 
--- a/util.h	Sat May 26 06:00:02 2012 +0300
+++ b/util.h	Sat May 26 06:01:06 2012 +0300
@@ -98,4 +98,9 @@
 nn_strtuple_t *nn_strtuple_new(size_t, char *);
 void nn_strtuple_free(nn_strtuple_t *);
 
+
+BOOL str_get_timestamp(char *str, size_t len, const char *fmt);
+char * str_trim_left(char *buf);
+int str_compare(const void *s1, const void *s2);
+
 #endif