summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-07-10 23:00:56 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-07-10 23:00:56 +0000
commitdcc2e89b2e0a99645b4f49360c3b76958730563e (patch)
tree824e1fb77f05e94a3b4cb48e051728eb9bd519a3 /src
parentf8aa81b73c83b97aff8cf24244e0bb183a35d59c (diff)
downloadirssi-dcc2e89b2e0a99645b4f49360c3b76958730563e.zip
Enabled lots of GCC warnings, fixed those that were easy to fix.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@456 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/core/levels.c2
-rw-r--r--src/core/misc.c16
-rw-r--r--src/core/network.c2
-rw-r--r--src/core/signals.c2
-rw-r--r--src/fe-common/core/completion.c4
-rw-r--r--src/fe-common/core/fe-settings.c3
-rw-r--r--src/fe-common/core/themes.c10
-rw-r--r--src/fe-common/irc/fe-ctcp.c18
-rw-r--r--src/fe-common/irc/fe-events.c3
-rw-r--r--src/fe-common/irc/fe-ignore.c11
-rw-r--r--src/fe-common/irc/fe-irc-commands.c3
-rw-r--r--src/fe-text/gui-printtext.c8
-rw-r--r--src/fe-text/gui-readline.c14
-rw-r--r--src/irc/bot/bot-users.c3
-rw-r--r--src/irc/bot/botnet.c4
-rw-r--r--src/irc/bot/botnet.h4
-rw-r--r--src/irc/dcc/dcc-files.c4
-rw-r--r--src/irc/dcc/dcc.c6
-rw-r--r--src/lib-config/parse.c4
-rw-r--r--src/lib-popt/Makefile.am4
-rw-r--r--src/lib-popt/findme.c10
-rw-r--r--src/lib-popt/popt.c17
-rw-r--r--src/lib-popt/poptconfig.c15
-rw-r--r--src/lib-popt/popthelp.c11
-rw-r--r--src/lib-popt/poptint.h12
25 files changed, 84 insertions, 106 deletions
diff --git a/src/core/levels.c b/src/core/levels.c
index 207c0619..8618f340 100644
--- a/src/core/levels.c
+++ b/src/core/levels.c
@@ -21,7 +21,7 @@
#include "module.h"
#include "levels.h"
-static char *levels[] =
+static const char *levels[] =
{
"CRAP",
"MSGS",
diff --git a/src/core/misc.c b/src/core/misc.c
index 3a3b76bb..4922dbc0 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -168,8 +168,10 @@ int copyfile(const char *src, const char *dest)
int len;
char buf[1024];
- while ((len = fread(buf, 1, sizeof(buf), fs)) > 0)
- if (fwrite(buf, 1, len, fd) != len) break;
+ while ((len = fread(buf, 1, sizeof(buf), fs)) > 0) {
+ if (fwrite(buf, 1, len, fd) != len)
+ break;
+ }
fclose(fd);
ret = TRUE;
}
@@ -330,8 +332,10 @@ char *stristr(const char *data, const char *key)
return NULL;
max = data+datalen-keylen;
- for (pos = data; pos <= max; pos++)
- if (g_strncasecmp(pos, key, keylen) == 0) return (char *) pos;
+ for (pos = data; pos <= max; pos++) {
+ if (g_strncasecmp(pos, key, keylen) == 0)
+ return (char *) pos;
+ }
return NULL;
}
@@ -397,12 +401,12 @@ int g_istr_cmp(gconstpointer v, gconstpointer v2)
/* a char* hash function from ASU */
unsigned int g_istr_hash(gconstpointer v)
{
- const char *s = (char *) v;
+ const char *s = (const char *) v;
unsigned int h = 0, g;
while (*s != '\0') {
h = (h << 4) + toupper(*s);
- if ((g = h & 0xf0000000)) {
+ if ((g = h & 0xf0000000UL)) {
h = h ^ (g >> 24);
h = h ^ g;
}
diff --git a/src/core/network.c b/src/core/network.c
index 5a6e276a..42d58bb3 100644
--- a/src/core/network.c
+++ b/src/core/network.c
@@ -403,7 +403,7 @@ int net_ip2host(IPADDR *ip, char *host)
ip4 = ntohl(ip->addr.ip.s_addr);
sprintf(host, "%lu.%lu.%lu.%lu",
- (ip4 & 0xff000000) >> 24,
+ (ip4 & 0xff000000UL) >> 24,
(ip4 & 0x00ff0000) >> 16,
(ip4 & 0x0000ff00) >> 8,
(ip4 & 0x000000ff));
diff --git a/src/core/signals.c b/src/core/signals.c
index 84cbb79d..cfc0da37 100644
--- a/src/core/signals.c
+++ b/src/core/signals.c
@@ -94,7 +94,7 @@ static void signal_destroy(int signal_id)
static int signal_list_find(GPtrArray *array, void *data)
{
- int n;
+ unsigned int n;
for (n = 0; n < array->len; n++) {
if (g_ptr_array_index(array, n) == data)
diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c
index 70415113..10153159 100644
--- a/src/fe-common/core/completion.c
+++ b/src/fe-common/core/completion.c
@@ -27,8 +27,8 @@
#include "completion.h"
-#define wordreplace_find(replace) \
- iconfig_list_find("replaces", "text", replace, "replace")
+#define wordreplace_find(word) \
+ iconfig_list_find("replaces", "text", word, "replace")
#define completion_find(completion) \
iconfig_list_find("completions", "short", completion, "long")
diff --git a/src/fe-common/core/fe-settings.c b/src/fe-common/core/fe-settings.c
index 4b8b04e7..75e50790 100644
--- a/src/fe-common/core/fe-settings.c
+++ b/src/fe-common/core/fe-settings.c
@@ -67,7 +67,8 @@ static void cmd_set(char *data)
{
GHashTable *optlist;
GSList *sets, *tmp;
- char *key, *value, *last_section;
+ const char *last_section;
+ char *key, *value;
void *free_arg;
int found, clear;
diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c
index 7df42738..16ef2b45 100644
--- a/src/fe-common/core/themes.c
+++ b/src/fe-common/core/themes.c
@@ -361,14 +361,16 @@ static void cmd_format(const char *data)
"format", &optlist, &module, &key, &value))
return;
- modules = get_sorted_modules();
- if (*module != '\0' && theme_search(modules, module) == NULL) {
+ modules = get_sorted_modules();
+ if (*module == '\0')
+ module = NULL;
+ else if (theme_search(modules, module) == NULL) {
/* first argument isn't module.. */
cmd_params_free(free_arg);
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS,
"format", &optlist, &key, &value))
return;
- module = "";
+ module = NULL;
}
reset = FALSE;
@@ -383,7 +385,7 @@ static void cmd_format(const char *data)
for (tmp = modules; tmp != NULL; tmp = tmp->next) {
THEME_SEARCH_REC *rec = tmp->data;
- if (*module == '\0' || g_strcasecmp(rec->short_name, module) == 0)
+ if (module == NULL || g_strcasecmp(rec->short_name, module) == 0)
theme_show(rec, key, value, reset);
}
g_slist_foreach(modules, (GFunc) g_free, NULL);
diff --git a/src/fe-common/irc/fe-ctcp.c b/src/fe-common/irc/fe-ctcp.c
index 6d469ba1..ffb5ae62 100644
--- a/src/fe-common/irc/fe-ctcp.c
+++ b/src/fe-common/irc/fe-ctcp.c
@@ -67,17 +67,23 @@ static void ctcp_time_msg(const char *data, IRC_SERVER_REC *server, const char *
static void ctcp_default_reply(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
{
- char *ptr, *str;
+ const char *ctcpdata;
+ char *ctcp, *ptr;
g_return_if_fail(data != NULL);
- str = g_strdup(data);
- ptr = strchr(str, ' ');
- if (ptr != NULL) *ptr++ = '\0'; else ptr = "";
+ ctcp = g_strdup(data);
+ ptr = strchr(ctcp, ' ');
+ if (ptr == NULL)
+ ctcpdata = "";
+ else {
+ *ptr = '\0';
+ ctcpdata = ptr+1;
+ }
printformat(server, ischannel(*target) ? target : nick, MSGLEVEL_CTCPS,
- ischannel(*target) ? IRCTXT_CTCP_REPLY_CHANNEL : IRCTXT_CTCP_REPLY, str, nick, ptr, target);
- g_free(str);
+ ischannel(*target) ? IRCTXT_CTCP_REPLY_CHANNEL : IRCTXT_CTCP_REPLY, ctcp, nick, ctcpdata, target);
+ g_free(ctcp);
}
static void ctcp_ping_reply(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
diff --git a/src/fe-common/irc/fe-events.c b/src/fe-common/irc/fe-events.c
index 320fcf34..7b82f365 100644
--- a/src/fe-common/irc/fe-events.c
+++ b/src/fe-common/irc/fe-events.c
@@ -60,7 +60,8 @@ static void print_channel_msg(IRC_SERVER_REC *server, const char *msg,
CHANNEL_REC *chanrec;
NICK_REC *nickrec;
int for_me;
- char *color, *nickmode;
+ const char *nickmode;
+ char *color;
chanrec = channel_find(server, target);
for_me = irc_nick_match(server->nick, msg);
diff --git a/src/fe-common/irc/fe-ignore.c b/src/fe-common/irc/fe-ignore.c
index 6366dd98..4cb0cf2b 100644
--- a/src/fe-common/irc/fe-ignore.c
+++ b/src/fe-common/irc/fe-ignore.c
@@ -165,7 +165,7 @@ static void cmd_ignore(const char *data)
if (ischannel(*mask)) {
chanarg = mask;
- mask = "";
+ mask = NULL;
}
channels = (chanarg == NULL || *chanarg == '\0') ? NULL :
g_strsplit(replace_chars(chanarg, ',', ' '), " ", -1);
@@ -176,7 +176,8 @@ static void cmd_ignore(const char *data)
if (rec == NULL) {
rec = g_new0(IGNORE_REC, 1);
- rec->mask = *mask == '\0' ? NULL : g_strdup(mask);
+ rec->mask = (mask != NULL && *mask != '\0') ?
+ g_strdup(mask) : NULL;
rec->channels = channels;
} else {
g_free_and_null(rec->pattern);
@@ -226,10 +227,10 @@ static void cmd_unignore(const char *data)
rec = tmp == NULL ? NULL : tmp->data;
} else {
/* with mask */
- char *chans[2] = { "*", NULL };
+ const char *chans[2] = { "*", NULL };
- if (ischannel(*data)) chans[0] = (char *) data;
- rec = ignore_find("*", ischannel(*data) ? NULL : data, chans);
+ if (ischannel(*data)) chans[0] = data;
+ rec = ignore_find("*", ischannel(*data) ? NULL : data, (char **) chans);
}
if (rec == NULL)
diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c
index 1852954b..19243c0d 100644
--- a/src/fe-common/irc/fe-irc-commands.c
+++ b/src/fe-common/irc/fe-irc-commands.c
@@ -95,7 +95,8 @@ static void cmd_msg(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
WINDOW_REC *window;
CHANNEL_REC *channel;
NICK_REC *nickrec;
- char *target, *msg, *nickmode, *freestr, *newtarget;
+ const char *nickmode;
+ char *target, *msg, *freestr, *newtarget;
void *free_arg;
int free_ret;
diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c
index 07f63ee9..89e2abd6 100644
--- a/src/fe-text/gui-printtext.c
+++ b/src/fe-text/gui-printtext.c
@@ -30,13 +30,13 @@
#include "screen.h"
#include "gui-windows.h"
-#define TEXT_CHUNK_USABLE_SIZE (LINE_TEXT_CHUNK_SIZE-2-sizeof(char*))
+#define TEXT_CHUNK_USABLE_SIZE (LINE_TEXT_CHUNK_SIZE-2-(int)sizeof(char*))
int mirc_colors[] = { 15, 0, 1, 2, 12, 6, 5, 4, 14, 10, 3, 11, 9, 13, 8, 7, 15 };
static int scrollback_lines, scrollback_hours;
#define mark_temp_eol(text) \
- memcpy((text)->buffer + (text)->pos, "\0\x80", 2);
+ memcpy((text)->buffer + (text)->pos, "\0\200", 2);
static LINE_REC *create_line(GUI_WINDOW_REC *gui, int level)
{
@@ -191,7 +191,7 @@ static void get_colors(int flags, int *fg, int *bg)
if (flags & PRINTFLAG_BLINK) *bg |= 0x80;
}
-static void linebuf_add(GUI_WINDOW_REC *gui, char *str, int len)
+static void linebuf_add(GUI_WINDOW_REC *gui, const char *str, int len)
{
int left;
@@ -271,7 +271,7 @@ static void gui_printtext(WINDOW_REC *window, gpointer fgcolor, gpointer bgcolor
/* \n can be only at the start of the line.. */
if (*str == '\n') {
str++;
- linebuf_add(gui, "\0\x80", 2); /* mark EOL */
+ linebuf_add(gui, "\0\200", 2); /* mark EOL */
line = create_line(gui, 0);
gui_window_newline(gui, visible);
diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c
index 2a5838b1..45e623c6 100644
--- a/src/fe-text/gui-readline.c
+++ b/src/fe-text/gui-readline.c
@@ -408,7 +408,7 @@ static void sig_addchar(const char *data)
gui_entry_insert_char(*data);
}
-static void sig_window_auto_changed(WINDOW_REC *window)
+static void sig_window_auto_changed(void)
{
command_history_next(active_win, gui_entry_get_text());
gui_entry_set_text("");
@@ -452,12 +452,12 @@ void gui_readline_init(void)
key_bind("prev page", "Previous page", "ALT-P", NULL, (SIGNAL_FUNC) sig_prev_page);
key_bind("next page", "Next page", "ALT-N", NULL, (SIGNAL_FUNC) sig_next_page);
- key_bind("special char", "Insert special character", "CTRL-B", "\x02", (SIGNAL_FUNC) sig_addchar);
- key_bind("special char", NULL, "CTRL--", "\x1f", (SIGNAL_FUNC) sig_addchar);
- key_bind("special char", NULL, "CTRL-C", "\x03", (SIGNAL_FUNC) sig_addchar);
- key_bind("special char", NULL, "CTRL-V", "\x16", (SIGNAL_FUNC) sig_addchar);
- key_bind("special char", NULL, "CTRL-G", "\x07", (SIGNAL_FUNC) sig_addchar);
- key_bind("special char", NULL, "CTRL-O", "\x0f", (SIGNAL_FUNC) sig_addchar);
+ key_bind("special char", "Insert special character", "CTRL-B", "\002", (SIGNAL_FUNC) sig_addchar);
+ key_bind("special char", NULL, "CTRL--", "\037", (SIGNAL_FUNC) sig_addchar);
+ key_bind("special char", NULL, "CTRL-C", "\003", (SIGNAL_FUNC) sig_addchar);
+ key_bind("special char", NULL, "CTRL-V", "\026", (SIGNAL_FUNC) sig_addchar);
+ key_bind("special char", NULL, "CTRL-G", "\007", (SIGNAL_FUNC) sig_addchar);
+ key_bind("special char", NULL, "CTRL-O", "\017", (SIGNAL_FUNC) sig_addchar);
for (n = 0; changekeys[n] != '\0'; n++) {
key = g_strdup_printf("ALT-%c", changekeys[n]);
diff --git a/src/irc/bot/bot-users.c b/src/irc/bot/bot-users.c
index b38a514b..2a012b66 100644
--- a/src/irc/bot/bot-users.c
+++ b/src/irc/bot/bot-users.c
@@ -18,7 +18,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE /* for crypt() */
+#endif
+
#include "module.h"
#include "signals.h"
#include "misc.h"
diff --git a/src/irc/bot/botnet.c b/src/irc/bot/botnet.c
index 190481d1..e1f00bb7 100644
--- a/src/irc/bot/botnet.c
+++ b/src/irc/bot/botnet.c
@@ -37,7 +37,7 @@ void botnet_users_init(void);
GSList *botnets;
-void bot_send_cmd(BOT_REC *bot, char *data)
+void bot_send_cmd(BOT_REC *bot, const char *data)
{
g_return_if_fail(bot != NULL);
g_return_if_fail(data != NULL);
@@ -46,7 +46,7 @@ void bot_send_cmd(BOT_REC *bot, char *data)
net_transmit(bot->handle, "\n", 1);
}
-void bot_send_cmdv(BOT_REC *bot, char *format, ...)
+void bot_send_cmdv(BOT_REC *bot, const char *format, ...)
{
va_list args;
char *str;
diff --git a/src/irc/bot/botnet.h b/src/irc/bot/botnet.h
index da022b22..e8b436d5 100644
--- a/src/irc/bot/botnet.h
+++ b/src/irc/bot/botnet.h
@@ -95,8 +95,8 @@ struct _botnet_rec {
extern GSList *botnets;
-void bot_send_cmd(BOT_REC *bot, char *data);
-void bot_send_cmdv(BOT_REC *bot, char *format, ...);
+void bot_send_cmd(BOT_REC *bot, const char *data);
+void bot_send_cmdv(BOT_REC *bot, const char *format, ...);
/* broadcast a message to everyone in bot network, except for `except_bot'
if it's not NULL. If botnet is NULL, the message is sent to all botnets. */
diff --git a/src/irc/dcc/dcc-files.c b/src/irc/dcc/dcc-files.c
index 9a68813f..3d17af01 100644
--- a/src/irc/dcc/dcc-files.c
+++ b/src/irc/dcc/dcc-files.c
@@ -268,7 +268,7 @@ static void dcc_ctcp_msg(const char *data, IRC_SERVER_REC *server,
{
char *type, *arg, *portstr, *sizestr;
void *free_arg;
- unsigned long size;
+ long size;
int port;
DCC_REC *dcc;
@@ -426,7 +426,7 @@ static void dcc_send_read_size(DCC_REC *dcc)
memcpy(&bytes, dcc->count_buf, 4);
bytes = (guint32) ntohl(bytes);
- dcc->gotalldata = bytes == dcc->transfd;
+ dcc->gotalldata = (long) bytes == dcc->transfd;
dcc->count_pos = 0;
if (!dcc->fastsend) {
diff --git a/src/irc/dcc/dcc.c b/src/irc/dcc/dcc.c
index 75dc5459..8986a6fb 100644
--- a/src/irc/dcc/dcc.c
+++ b/src/irc/dcc/dcc.c
@@ -38,7 +38,7 @@ void dcc_files_deinit(void);
#define DCC_TYPES 5
-static char *dcc_types[] = {
+static const char *dcc_types[] = {
"CHAT",
"SEND",
"GET",
@@ -282,7 +282,7 @@ static void dcc_ctcp_msg(char *data, IRC_SERVER_REC *server, char *sender, char
void *free_arg;
const char *cstr;
DCC_REC *dcc;
- gulong size;
+ long size;
int port;
g_return_if_fail(data != NULL);
@@ -293,7 +293,7 @@ static void dcc_ctcp_msg(char *data, IRC_SERVER_REC *server, char *sender, char
return;
if (sscanf(portstr, "%d", &port) != 1) port = 0;
- if (sscanf(sizestr, "%lu", &size) != 1) size = 0;
+ if (sscanf(sizestr, "%ld", &size) != 1) size = 0;
dcc = dcc_create(SWAP_SENDGET(dcc_str2type(type)), -1, sender, arg, server, chat);
dcc_get_address(addrstr, &dcc->addr);
diff --git a/src/lib-config/parse.c b/src/lib-config/parse.c
index 0032b824..ba5d9b34 100644
--- a/src/lib-config/parse.c
+++ b/src/lib-config/parse.c
@@ -28,12 +28,12 @@ static int g_istr_equal(gconstpointer v, gconstpointer v2)
/* a char* hash function from ASU */
static unsigned int g_istr_hash(gconstpointer v)
{
- const char *s = (char *) v;
+ const char *s = (const char *) v;
unsigned int h = 0, g;
while (*s != '\0') {
h = (h << 4) + toupper(*s);
- if ((g = h & 0xf0000000)) {
+ if ((g = h & 0xf0000000UL)) {
h = h ^ (g >> 24);
h = h ^ g;
}
diff --git a/src/lib-popt/Makefile.am b/src/lib-popt/Makefile.am
index eeef0560..04f9145c 100644
--- a/src/lib-popt/Makefile.am
+++ b/src/lib-popt/Makefile.am
@@ -1,5 +1,9 @@
noinst_LTLIBRARIES = libpopt.la
+INCLUDES = \
+ $(GLIB_CFLAGS) \
+ -I$(top_srcdir)/src
+
libpopt_la_SOURCES = \
findme.c popt.c poptconfig.c popthelp.c poptparse.c
diff --git a/src/lib-popt/findme.c b/src/lib-popt/findme.c
index 1cda62c5..bcbe1941 100644
--- a/src/lib-popt/findme.c
+++ b/src/lib-popt/findme.c
@@ -2,14 +2,8 @@
file accompanying popt source distributions, available from
ftp://ftp.redhat.com/pub/code/popt */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "common.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
#ifdef __NeXT
/* access macros are not declared in non posix mode in unistd.h -
don't try to use posix on NeXTstep 3.3 ! */
@@ -31,7 +25,7 @@ char * findProgramPath(char * argv0) {
/* If there is a / in the argv[0], it has to be an absolute
path */
if (strchr(argv0, '/'))
- return strdup(argv0);
+ return g_strdup(argv0);
if (!path) return NULL;
diff --git a/src/lib-popt/popt.c b/src/lib-popt/popt.c
index cd396b3b..7b11a3c3 100644
--- a/src/lib-popt/popt.c
+++ b/src/lib-popt/popt.c
@@ -2,18 +2,7 @@
file accompanying popt source distributions, available from
ftp://ftp.redhat.com/pub/code/popt */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <errno.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
+#include "common.h"
#if HAVE_ALLOCA_H
# include <alloca.h>
@@ -25,7 +14,7 @@
void poptSetExecPath(poptContext con, const char * path, int allowAbsolute) {
if (con->execPath) free(con->execPath);
- con->execPath = strdup(path);
+ con->execPath = g_strdup(path);
con->execAbsolute = allowAbsolute;
}
@@ -449,7 +438,7 @@ int poptGetNextOpt(poptContext con) {
if (opt->arg && (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE
&& (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_VAL)
- con->finalArgv[con->finalArgvCount++] = strdup(con->os->nextArg);
+ con->finalArgv[con->finalArgvCount++] = g_strdup(con->os->nextArg);
}
return opt->val;
diff --git a/src/lib-popt/poptconfig.c b/src/lib-popt/poptconfig.c
index fce6d74e..67c084e5 100644
--- a/src/lib-popt/poptconfig.c
+++ b/src/lib-popt/poptconfig.c
@@ -2,16 +2,7 @@
file accompanying popt source distributions, available from
ftp://ftp.redhat.com/pub/code/popt */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
+#include "common.h"
#if HAVE_ALLOCA_H
# include <alloca.h>
@@ -58,12 +49,12 @@ static void configLine(poptContext con, char * line) {
con->execs = realloc(con->execs,
sizeof(*con->execs) * (con->numExecs + 1));
if (longName)
- con->execs[con->numExecs].longName = strdup(longName);
+ con->execs[con->numExecs].longName = g_strdup(longName);
else
con->execs[con->numExecs].longName = NULL;
con->execs[con->numExecs].shortName = shortName;
- con->execs[con->numExecs].script = strdup(line);
+ con->execs[con->numExecs].script = g_strdup(line);
con->numExecs++;
}
diff --git a/src/lib-popt/popthelp.c b/src/lib-popt/popthelp.c
index fb945d41..7d1567c4 100644
--- a/src/lib-popt/popthelp.c
+++ b/src/lib-popt/popthelp.c
@@ -4,14 +4,7 @@
file accompanying popt source distributions, available from
ftp://ftp.redhat.com/pub/code/popt */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "common.h"
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
@@ -302,5 +295,5 @@ void poptPrintUsage(poptContext con, FILE * f, int flags) {
void poptSetOtherOptionHelp(poptContext con, const char * text) {
if (con->otherHelp) free(con->otherHelp);
- con->otherHelp = strdup(text);
+ con->otherHelp = g_strdup(text);
}
diff --git a/src/lib-popt/poptint.h b/src/lib-popt/poptint.h
index 8fc6a84c..a1346716 100644
--- a/src/lib-popt/poptint.h
+++ b/src/lib-popt/poptint.h
@@ -43,16 +43,6 @@ struct poptContext_s {
char * otherHelp;
};
-#ifdef HAVE_LIBINTL_H
-#include <libintl.h>
-#endif
-
-#ifdef HAVE_GETTEXT
-#define _(foo) gettext(foo)
-#else
-#define _(foo) (foo)
-#endif
-
#ifdef HAVE_DGETTEXT
#define D_(dom, str) dgettext(dom, str)
#define POPT_(foo) D_("popt", foo)
@@ -61,6 +51,4 @@ struct poptContext_s {
#define D_(dom, str) (str)
#endif
-#define N_(foo) (foo)
-
#endif