billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=4bc712b07daf36bee5d76a0e4a42096694e0750e

commit 4bc712b07daf36bee5d76a0e4a42096694e0750e
Author: Boris Faure <bill...@gmail.com>
Date:   Tue Jun 23 13:11:09 2020 +0200

    utils.{c,h} is needed
---
 src/bin/meson.build     |  3 +++
 src/bin/private.h       | 23 +++++++++++++++++++++++
 src/bin/termio.c        |  1 +
 src/bin/termiolink.c    |  1 +
 src/bin/theme.c         | 19 +------------------
 src/bin/theme.h         | 28 ++--------------------------
 src/bin/tytest_common.c |  6 ------
 7 files changed, 31 insertions(+), 50 deletions(-)

diff --git a/src/bin/meson.build b/src/bin/meson.build
index f2d3899..5d5b8f5 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -32,6 +32,7 @@ terminology_sources = ['private.h',
                        'termptyext.c', 'termptyext.h',
                        'backlog.c', 'backlog.h',
                        'md5.c', 'md5.h',
+                       'utils.c', 'utils.h',
                        'utf8.c', 'utf8.h',
                        'win.c', 'win.h',
                        'theme.c', 'theme.h',
@@ -60,6 +61,7 @@ tyfuzz_sources = ['termptyesc.c', 'termptyesc.h',
                   'col.c', 'col.h',
                   'sb.c', 'sb.h',
                   'theme.h',
+                  'utils.c', 'utils.h',
                   'utf8.c', 'utf8.h',
                   'tytest_common.c', 'tytest_common.h',
                   'tyfuzz.c']
@@ -76,6 +78,7 @@ tytest_sources = ['termptyesc.c', 'termptyesc.h',
                   'col.c', 'col.h',
                   'sb.c', 'sb.h',
                   'utf8.c', 'utf8.h',
+                  'utils.c', 'utils.h',
                   'theme.h',
                   'md5.c', 'md5.h',
                   'unit_tests.h',
diff --git a/src/bin/private.h b/src/bin/private.h
index 2f4d517..b91d8e2 100644
--- a/src/bin/private.h
+++ b/src/bin/private.h
@@ -52,4 +52,27 @@ extern int _log_domain;
      (DIV_ROUND_UP((_v), (_n)) * (_n))
 #endif
 
+
+#define casestartswith(str, constref) \
+  (!strncasecmp(str, constref, sizeof(constref) - 1))
+#define startswith(str, constref) \
+  (!strncmp(str, constref, sizeof(constref) - 1))
+
+#if !defined(HAVE_STRCHRNUL)
+static inline char *
+strchrnul(const char *s, int c)
+{
+   const char *p = s;
+
+   while (*p)
+     {
+        if (*p == c)
+          return (char *)p;
+
+        ++p;
+     }
+   return (char *)  (p);
+}
+#endif
+
 #endif
diff --git a/src/bin/termio.c b/src/bin/termio.c
index b07fda3..ddf2f99 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -19,6 +19,7 @@
 #include "miniview.h"
 #include "gravatar.h"
 #include "sb.h"
+#include "utils.h"
 
 #if defined (__MacOSX__) || (defined (__MACH__) && defined (__APPLE__))
 # include <sys/proc_info.h>
diff --git a/src/bin/termiolink.c b/src/bin/termiolink.c
index 69f2f35..8d4a63f 100644
--- a/src/bin/termiolink.c
+++ b/src/bin/termiolink.c
@@ -12,6 +12,7 @@
 #include "sb.h"
 #include "utf8.h"
 #include "theme.h"
+#include "utils.h"
 #else
 #include <assert.h>
 #include <math.h>
diff --git a/src/bin/theme.c b/src/bin/theme.c
index 0f9e4f2..582ac4f 100644
--- a/src/bin/theme.c
+++ b/src/bin/theme.c
@@ -1,6 +1,7 @@
 #include "private.h"
 #include "theme.h"
 #include "config.h"
+#include "utils.h"
 #include <unistd.h>
 #include <pwd.h>
 
@@ -154,24 +155,6 @@ theme_auto_reload_enable(Evas_Object *edje)
      (edje, "edje,change,file", "edje", theme_reload_cb, NULL);
 }
 
-Eina_Bool
-homedir_get(char *buf, size_t size)
-{
-   const char *home = getenv("HOME");
-   if (!home)
-     {
-        uid_t uid = getuid();
-        struct passwd *pw = getpwuid(uid);
-        if (pw) home = pw->pw_dir;
-     }
-   if (!home)
-     {
-        ERR("Could not get $HOME");
-        return EINA_FALSE;
-     }
-   return eina_strlcpy(buf, home, size) < size;
-}
-
 Eina_Bool
 utils_need_scale_wizard(void)
 {
diff --git a/src/bin/theme.h b/src/bin/theme.h
index cbad8ec..3e6df7a 100644
--- a/src/bin/theme.h
+++ b/src/bin/theme.h
@@ -1,5 +1,5 @@
-#ifndef _UTILS_H__
-#define _UTILS_H__
+#ifndef _THEME_H__
+#define _THEME_H__
 
 #include <Evas.h>
 #include "config.h"
@@ -11,32 +11,8 @@ void theme_reload(Evas_Object *edje);
 void theme_auto_reload_enable(Evas_Object *edje);
 const char *theme_path_get(const char *name);
 
-Eina_Bool homedir_get(char *buf, size_t size);
 Eina_Bool utils_need_scale_wizard(void);
 
-#define casestartswith(str, constref) \
-  (!strncasecmp(str, constref, sizeof(constref) - 1))
-#define startswith(str, constref) \
-  (!strncmp(str, constref, sizeof(constref) - 1))
-
-#if !defined(HAVE_STRCHRNUL)
-static inline char *
-strchrnul(const char *s, int c)
-{
-   const char *p = s;
-
-   while (*p)
-     {
-        if (*p == c)
-          return (char *)p;
-
-        ++p;
-     }
-   return (char *)  (p);
-}
-#endif
-
-
 #if (ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR < 20)
 #   if __GNUC__ >= 7
 #    define EINA_FALLTHROUGH __attribute__ ((fallthrough));
diff --git a/src/bin/tytest_common.c b/src/bin/tytest_common.c
index fa4e1cb..6cbfa91 100644
--- a/src/bin/tytest_common.c
+++ b/src/bin/tytest_common.c
@@ -306,12 +306,6 @@ termio_color_class_set(Evas_Object *termio EINA_UNUSED, 
const char *key,
    return -1;
 }
 
-Eina_Bool
-homedir_get(char *buf, size_t size)
-{
-   return eina_strlcpy(buf, "/home/foo", size) < size;
-}
-
 void
 termio_reset_main_colors(Evas_Object *termio EINA_UNUSED)
 {

-- 


Reply via email to