Use more Glib replacement functionstrdup s
authorJelmer Vernooij <jelmer@samba.org>
Sat, 1 Apr 2006 18:07:20 +0000 (20:07 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 1 Apr 2006 18:07:20 +0000 (20:07 +0200)
Makefile
configure.ac
linestack_file.c
mods/log_custom.c
mods/log_irssi.c
mods/nss.c
mods/openssl.c
mods/python2.c
mods/repl_highlight.c
settings.c
util.c

index 5a4115d3095a5d4eb8b8fa8aca44124c2426d919..6c601654ced52be909840bd5823f6c65a2b5a106 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -74,7 +74,7 @@ mods/lib%.so: mods/%.o
 clean::
        rm -f $(MODS_SHARED_FILES)
        rm -f *.$(OBJEXT) ctrlproxy$(EXEEXT) printstats *~
-       rm -f *.gcov *.gcno *.gcda
+       rm -f *.gcov *.gcno *.gcda mods/*.o
 
 dist: distclean
        $(MAKE) -C doc dist
@@ -109,7 +109,7 @@ install-python: all
 clean::
        rm -f *_wrap.c *.pyc
        rm -f ctrlproxy.py admin.py listener.py
-       $(PYTHON) setup.py clean
+#      $(PYTHON) setup.py clean
        rm -rf build/
 
 # RFC compliance testing using ircdtorture
index 70f62f62257691fff1c3306aca35a21577579f33..7dcb3fc29c86e2638374d77873e35c9d18735a6c 100644 (file)
@@ -55,7 +55,7 @@ AC_FUNC_MALLOC
 AC_FUNC_REALLOC
 AC_TYPE_SIGNAL
 
-AC_CHECK_FUNCS([gethostbyname gethostname memset mkdir strcasecmp strchr strdup strerror strncasecmp strstr uname backtrace_symbols gettimeofday strrchr daemon])
+AC_CHECK_FUNCS([gethostbyname gethostname memset strchr strerror strstr uname backtrace_symbols gettimeofday strrchr daemon])
 
 PKG_CHECK_MODULES(COMMON, glib-2.0 gmodule-2.0, , AC_MSG_ERROR([glib is required]))
 
index e793b2f1dc5b141235c808b663a805f2f5478e37..91fd46c62ea15b868dc7c5745a6edd394ed0ca04 100644 (file)
 #include <unistd.h>
 #endif
 
+#include <glib/gstdio.h>
 #include <sys/stat.h>
 
-#ifdef _WIN32
-#include <direct.h>
-#define mkdir(s,t) _mkdir(s)
-#endif
-
 #define STATE_DUMP_INTERVAL 1000
 
 struct record_header {
@@ -63,7 +59,7 @@ static gboolean file_init(struct linestack_context *ctx, struct ctrlproxy_config
 {
        struct lf_data *data = g_new0(struct lf_data, 1);
        data->data_path = g_build_filename(config->config_dir, "linestack_file", NULL);
-       mkdir(data->data_path, 0700);
+       g_mkdir(data->data_path, 0700);
        data->networks = g_hash_table_new_full(NULL, NULL, NULL, free_lf_network_data);
        ctx->backend_data = data;
        return TRUE;
index a7a69f2cdc595399d1f05cbbe0775831456bfad5..f4511f9347f46743c4e89d5ad4ba2806a8429a36 100644 (file)
 #include <stdio.h>
 #include <time.h>
 #include <glib.h>
+#include <glib/gstdio.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
-#ifdef _WIN32
-#include <direct.h>
-#define mkdir(s,t) _mkdir(s)
-#endif
-
-
 #define MAX_SUBST 256
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN "log_custom"
@@ -308,7 +303,7 @@ static FILE *find_add_channel_file(struct log_custom_data *data, struct network
                if(p) *p = '\0';
 
                /* Check if directory needs to be created */
-               if(!g_file_test(dn, G_FILE_TEST_IS_DIR) && mkdir(dn, 0700) == -1) {
+               if(!g_file_test(dn, G_FILE_TEST_IS_DIR) && g_mkdir(dn, 0700) == -1) {
                        log_network("log_custom", LOG_ERROR, network, "Couldn't create directory %s for logging!", dn);
                        g_free(dn);
                        g_free(n);
index 5e29904cb1433a90be50cd535eacb9c237cd598a..c4b379800645423252292c892abbe0a53c3413e5 100644 (file)
 #include <stdio.h>
 #include <time.h>
 #include <glib.h>
+#include <glib/gstdio.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#ifdef _WIN32
-#include <direct.h>
-#define mkdir(s,t) _mkdir(s)
-#endif
 
 
 
@@ -62,7 +59,7 @@ static FILE *find_add_channel_file(struct network *s, const char *name) {
 
                n = g_strdup_printf("%s/%s", logfile, server_name);
                /* Check if directory needs to be created */
-               if(!g_file_test(n, G_FILE_TEST_IS_DIR) && mkdir(n, 0700) == -1) {
+               if(!g_file_test(n, G_FILE_TEST_IS_DIR) && g_mkdir(n, 0700) == -1) {
                        log_network("log_irssi", LOG_ERROR, s, "Couldn't create directory %s for logging!", n);
                        g_free(hash_name);
                        g_free(n);
@@ -102,7 +99,7 @@ static FILE *find_channel_file(struct network *s, const char *name) {
 
 static gboolean log_data(struct network *n, struct line *l, enum data_direction dir, void *userdata)
 {
-       const char *nick = NULL;
+       char *nick = NULL;
        const char *dest = NULL;
        time_t ti = time(NULL);
        char *user = NULL;
@@ -224,7 +221,7 @@ static void load_config(struct global *global)
        }
        
        /* Create logfile directory if it doesn't exist yet */
-       mkdir(logfile, 0700);
+       g_mkdir(logfile, 0700);
 
        add_log_filter("log_irssi", log_data, NULL, 1000);
 }
index 6fed12883eb5b186064dbeb8168481bfbf0a178c..00833c73c75cc0334fd6da993ee6bb1c5dc98ea2 100644 (file)
@@ -129,11 +129,6 @@ static GIOFuncs g_io_nss_channel_funcs = {
 
 GIOChannel *g_io_nss_get_iochannel(GIOChannel *handle, gboolean server);
 
-static gboolean fini_plugin(struct plugin *p)
-{
-       return TRUE;
-}
-
 static PRDescIdentity _identity;
 
 static gboolean init_plugin(void)
index 73f3e6f3d30150b1488c8d372211295c5a9d60fd..b50c95db094b321af87d7eb236bc57f5eae6ca32 100644 (file)
@@ -193,10 +193,6 @@ GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, gboolean server);
 static gboolean irssi_ssl_set_files(const char *certf, const char *keyf);
 static SSL_CTX *ssl_ctx = NULL;
 
-static gboolean fini_plugin(struct plugin *p) {
-       return TRUE;
-}
-
 static void load_config(struct global *global)
 {
        const char *keyf = NULL, *certf = NULL;
@@ -236,7 +232,7 @@ static gboolean init_plugin(void)
        }
 
        set_sslize_function (irssi_ssl_get_iochannel);
-       register_config_notify(load_config);
+       register_load_config_notify(load_config);
 
        return TRUE;
 }
index 511dd504499e866fbb38b9084b419e334474fb4b..74222b48c24b70c6e94fe18eb781775c62f22a05 100644 (file)
@@ -70,7 +70,7 @@ static gboolean init_plugin(void)
 {
        Py_Initialize();
 
-       register_config_notify(load_config);
+       register_load_config_notify(load_config);
        return TRUE;
 }
 
index b8a3706c7456a6aff291ce5813294eff395460a9..9a17e47956270c15ca1afd98de7cb73daaca6fe8 100644 (file)
@@ -28,8 +28,8 @@ static void check_highlight(struct line *l, time_t t, void *userdata)
        struct client *c = userdata;
     int i;
 
-       if (strcasecmp(l->args[0], "PRIVMSG") != 0 &&
-               strcasecmp(l->args[0], "NOTICE") != 0) 
+       if (g_strcasecmp(l->args[0], "PRIVMSG") != 0 &&
+               g_strcasecmp(l->args[0], "NOTICE") != 0) 
                return;
        
        for (i = 0; matches[i]; i++) {
index 4b20f50d73325c457af6ebde0c4af21d66404bea..442b4e45a52842675ea4ada1b5e2ed3b7f6ada08 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <netdb.h>
 #include <sys/socket.h>
+#include <glib/gstdio.h>
 
 gboolean g_key_file_save_to_file(GKeyFile *kf, const gchar *file, GError **error)
 {
@@ -130,7 +131,7 @@ static void config_save_networks(const char *config_dir, GList *networks)
        GList *gl;
 
        if (!g_file_test(networksdir, G_FILE_TEST_IS_DIR)) {
-               if (mkdir(networksdir, 0700) != 0) {
+               if (g_mkdir(networksdir, 0700) != 0) {
                        log_global(NULL, LOG_ERROR, "Can't create networks directory '%s': %s", networksdir, strerror(errno));
                        return;
                }
@@ -388,7 +389,7 @@ struct network_config *network_config_init(struct ctrlproxy_config *cfg)
 
 void setup_configdir(const char *dir)
 {
-       if(mkdir(dir, 0700) != 0) {
+       if(g_mkdir(dir, 0700) != 0) {
                log_global(NULL, LOG_ERROR, "Unable to open configuration directory '%s'\n", dir);
                return;
        }
diff --git a/util.c b/util.c
index 67d46a1332be4835ac4ff1e782579a8b49e52128..445e1dc5bfe49572cf2646274f0dbc55f334c791 100644 (file)
--- a/util.c
+++ b/util.c
 #include "internals.h"
 #include <errno.h>
 #include <ctype.h>
-#ifdef _WIN32
-#include <direct.h>
-#define mkdir(s,t) _mkdir(s)
-#endif
 
 char *list_make_string(GList *list)
 {