summaryrefslogtreecommitdiff
path: root/src/lib-popt
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/lib-popt
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/lib-popt')
-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
6 files changed, 14 insertions, 55 deletions
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