summaryrefslogtreecommitdiffstats
path: root/common/strlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/strlist.c')
-rw-r--r--common/strlist.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/common/strlist.c b/common/strlist.c
index 6816dcf1a..e29fd468e 100644
--- a/common/strlist.c
+++ b/common/strlist.c
@@ -35,11 +35,10 @@
#include <stdarg.h>
#include <ctype.h>
-#include "libjnlib-config.h"
+#include "util.h"
+#include "common-defs.h"
#include "strlist.h"
-#ifdef JNLIB_NEED_UTF8CONV
#include "utf8conv.h"
-#endif
void
free_strlist( strlist_t sl )
@@ -48,7 +47,7 @@ free_strlist( strlist_t sl )
for(; sl; sl = sl2 ) {
sl2 = sl->next;
- jnlib_free(sl);
+ xfree(sl);
}
}
@@ -60,7 +59,7 @@ add_to_strlist( strlist_t *list, const char *string )
{
strlist_t sl;
- sl = jnlib_xmalloc( sizeof *sl + strlen(string));
+ sl = xmalloc( sizeof *sl + strlen(string));
sl->flags = 0;
strcpy(sl->d, string);
sl->next = *list;
@@ -76,7 +75,7 @@ add_to_strlist_try (strlist_t *list, const char *string)
{
strlist_t sl;
- sl = jnlib_malloc (sizeof *sl + strlen (string));
+ sl = xtrymalloc (sizeof *sl + strlen (string));
if (sl)
{
sl->flags = 0;
@@ -91,7 +90,6 @@ add_to_strlist_try (strlist_t *list, const char *string)
/* Same as add_to_strlist() but if IS_UTF8 is *not* set, a conversion
to UTF-8 is done. This function terminates the process on memory
shortage. */
-#ifdef JNLIB_NEED_UTF8CONV
strlist_t
add_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
{
@@ -103,11 +101,10 @@ add_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
{
char *p = native_to_utf8( string );
sl = add_to_strlist( list, p );
- jnlib_free ( p );
+ xfree ( p );
}
return sl;
}
-#endif /* JNLIB_NEED_UTF8CONV*/
/* Add STRING to the LIST at the end. This function terminates the
@@ -117,7 +114,7 @@ append_to_strlist( strlist_t *list, const char *string )
{
strlist_t r, sl;
- sl = jnlib_xmalloc( sizeof *sl + strlen(string));
+ sl = xmalloc( sizeof *sl + strlen(string));
sl->flags = 0;
strcpy(sl->d, string);
sl->next = NULL;
@@ -132,7 +129,6 @@ append_to_strlist( strlist_t *list, const char *string )
}
-#ifdef JNLIB_NEED_UTF8CONV
strlist_t
append_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
{
@@ -144,11 +140,10 @@ append_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
{
char *p = native_to_utf8 (string);
sl = append_to_strlist( list, p );
- jnlib_free( p );
+ xfree( p );
}
return sl;
}
-#endif /* JNLIB_NEED_UTF8CONV */
/* Return a copy of LIST. This function terminates the process on
@@ -161,7 +156,7 @@ strlist_copy (strlist_t list)
last = &newlist;
for (; list; list = list->next)
{
- sl = jnlib_xmalloc (sizeof *sl + strlen (list->d));
+ sl = xmalloc (sizeof *sl + strlen (list->d));
sl->flags = list->flags;
strcpy(sl->d, list->d);
sl->next = NULL;
@@ -204,11 +199,11 @@ strlist_pop (strlist_t *list)
if(sl)
{
- str=jnlib_xmalloc(strlen(sl->d)+1);
+ str = xmalloc(strlen(sl->d)+1);
strcpy(str,sl->d);
*list=sl->next;
- jnlib_free(sl);
+ xfree(sl);
}
return str;