From c8aada787d1065262e5965ce7688ba613ce7a28e Mon Sep 17 00:00:00 2001
From: obarun <eric@obarun.org>
Date: Wed, 14 Jun 2023 23:22:55 +1100
Subject: [PATCH] remove ugly and unused function

---
 src/include/66/module.h                  |  2 -
 src/lib66/module/deps-lib/deps           |  2 -
 src/lib66/module/module_in_cmdline.c     | 59 ----------------
 src/lib66/module/module_search_service.c | 88 ------------------------
 4 files changed, 151 deletions(-)
 delete mode 100644 src/lib66/module/module_in_cmdline.c
 delete mode 100644 src/lib66/module/module_search_service.c

diff --git a/src/include/66/module.h b/src/include/66/module.h
index fe5c2225..20837a2c 100644
--- a/src/include/66/module.h
+++ b/src/include/66/module.h
@@ -41,7 +41,5 @@ extern void regex_get_regex(char *regex, char const *str) ;
 extern void regex_get_replace(char *replace, char const *str) ;
 extern void regex_rename(stralloc *list, resolve_service_t *res, uint32_t element) ;
 extern void regex_replace(stralloc *list, resolve_service_t *res) ;
-extern int module_in_cmdline(genalloc *gares, resolve_service_t *res, char const *dir) ;
-extern int module_search_service(char const *src, genalloc *gares, char const *name,uint8_t *found, char module_name[256]) ;
 
 #endif
diff --git a/src/lib66/module/deps-lib/deps b/src/lib66/module/deps-lib/deps
index 259e0c49..a513575f 100644
--- a/src/lib66/module/deps-lib/deps
+++ b/src/lib66/module/deps-lib/deps
@@ -1,6 +1,4 @@
 get_list.o
-module_in_cmdline.o
-module_search_service.o
 parse_module.o
 parse_module_check_dir.o
 regex_configure.o
diff --git a/src/lib66/module/module_in_cmdline.c b/src/lib66/module/module_in_cmdline.c
deleted file mode 100644
index 06d297b2..00000000
--- a/src/lib66/module/module_in_cmdline.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * module_in_cmdline.c
- *
- * Copyright (c) 2018-2021 Eric Vidal <eric@obarun.org>
- *
- * All rights reserved.
- *
- * This file is part of Obarun. It is subject to the license terms in
- * the LICENSE file found in the top-level directory of this
- * distribution.
- * This file may not be copied, modified, propagated, or distributed
- * except according to the terms contained in the LICENSE file./
- */
-
-#include <stdlib.h>
-
-#include <oblibs/sastr.h>
-
-#include <skalibs/genalloc.h>
-#include <skalibs/stralloc.h>
-
-#include <66/service.h>
-#include <66/resolve.h>
-#include <66/enum.h>
-#include <66/utils.h>
-
-int module_in_cmdline(genalloc *gares, resolve_service_t *res, char const *dir)
-{
-    log_flow() ;
-
-    int e = 0 ;
-/*    stralloc tmp = STRALLOC_ZERO ;
-    size_t pos = 0 ;
-    resolve_wrapper_t_ref wres = resolve_set_struct(DATA_SERVICE, res) ;
-
-    if (!resolve_append(gares,wres)) goto err ;
-
-    if (res->dependencies.depends)
-    {
-        if (!sastr_clean_string(&tmp,res->sa.s + res->dependencies.depends))
-            goto err ;
-    }
-    for (; pos < tmp.len ; pos += strlen(tmp.s + pos) + 1)
-    {
-        char *name = tmp.s + pos ;
-        if (!resolve_check(dir,name)) goto err ;
-        if (!resolve_read(wres,dir,name)) goto err ;
-        if (res->type == TYPE_CLASSIC)
-            if (resolve_search(gares,name, DATA_SERVICE) < 0)
-                if (!resolve_append(gares,wres)) goto err ;
-    }
-
-    e = 1 ;
-
-    err:
-        free(wres) ;
-        stralloc_free(&tmp) ;
-  */      return e ;
-}
diff --git a/src/lib66/module/module_search_service.c b/src/lib66/module/module_search_service.c
deleted file mode 100644
index 5aa0e655..00000000
--- a/src/lib66/module/module_search_service.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * module_search_service.c
- *
- * Copyright (c) 2018-2021 Eric Vidal <eric@obarun.org>
- *
- * All rights reserved.
- *
- * This file is part of Obarun. It is subject to the license terms in
- * the LICENSE file found in the top-level directory of this
- * distribution.
- * This file may not be copied, modified, propagated, or distributed
- * except according to the terms contained in the LICENSE file./
- */
-
-#include <sys/types.h>
-#include <string.h>
-
-#include <oblibs/log.h>
-#include <oblibs/string.h>
-#include <oblibs/sastr.h>
-
-#include <skalibs/genalloc.h>
-#include <skalibs/stralloc.h>
-
-#include <66/constants.h>
-#include <66/service.h>
-#include <66/resolve.h>
-#include <66/enum.h>
-#include <66/utils.h>
-
-int module_search_service(char const *src, genalloc *gares, char const *name,uint8_t *found, char module_name[256])
-{
-    log_flow() ;
-
-    int e = 0 ;
-    size_t srclen = strlen(src), pos = 0, deps = 0 ;
-    stralloc list = STRALLOC_ZERO ;
-    stralloc tmp = STRALLOC_ZERO ;
-    resolve_service_t res = RESOLVE_SERVICE_ZERO ;
-    resolve_wrapper_t_ref wres = resolve_set_struct(DATA_SERVICE, &res) ;
-    char const *exclude[2] = { SS_MASTER + 1, 0 } ;
-
-    char t[srclen + SS_RESOLVE_LEN + 1] ;
-    auto_strings(t,src,SS_RESOLVE) ;
-
-    if (!sastr_dir_get(&list,t,exclude,S_IFREG)) goto err ;
-
-    for (;pos < list.len ; pos += strlen(list.s + pos) + 1)
-    {
-        char *dname = list.s + pos ;
-        if (!resolve_read(wres,src,dname)) goto err ;
-        if (res.type == TYPE_MODULE && res.dependencies.depends)
-        {
-            if (!sastr_clean_string(&tmp,res.sa.s + res.dependencies.depends)) goto err ;
-            for (deps = 0 ; deps < tmp.len ; deps += strlen(tmp.s + deps) + 1)
-            {
-                if (!strcmp(name,tmp.s + deps))
-                {
-                    (*found)++ ;
-                    if (strlen(dname) > 255) log_1_warn_return(LOG_EXIT_ZERO,"module name too long") ;
-                    auto_strings(module_name,dname) ;
-                    goto end ;
-                }
-            }
-        }
-    }
-    end:
-    /** search if the service is on the commandline
-     * if not we crash */
-    for(pos = 0 ; pos < genalloc_len(resolve_service_t,gares) ; pos++)
-    {
-        resolve_service_t_ref pres = &genalloc_s(resolve_service_t, gares)[pos] ;
-        char *str = pres->sa.s ;
-        char *name = str + pres->name ;
-        if (!strcmp(name,module_name)) {
-            (*found) = 0 ;
-            break ;
-        }
-    }
-
-    e = 1 ;
-
-    err:
-        stralloc_free(&list) ;
-        stralloc_free(&tmp) ;
-        resolve_free(wres) ;
-        return e ;
-}
-- 
GitLab