From 0d4e50665735576e112824fb9b466ce9366c52e4 Mon Sep 17 00:00:00 2001 From: Aaron Bockover Date: Wed, 16 Aug 2006 22:50:00 +0000 Subject: [PATCH] 2006-08-16 Aaron Bockover * src/gstr.c: Added g_strsplit implementation * test/driver.c: Run the split test * test/str.c: Added a test for g_strsplit * Makefile.am: * src/Makefile.am: * test/Makefile.am: Added MAINTAINERCLEANFILES svn path=/trunk/mono/; revision=63857 --- eglib/ChangeLog | 12 ++ eglib/Makefile.am | 21 +- eglib/missing | 219 --------------------- eglib/src/Makefile.am | 5 +- eglib/src/Makefile.in | 434 ----------------------------------------- eglib/src/gstr.c | 54 ++++- eglib/test/Makefile.am | 3 + eglib/test/driver.c | 1 + eglib/test/str.c | 20 ++ 9 files changed, 111 insertions(+), 658 deletions(-) delete mode 100644 eglib/missing delete mode 100644 eglib/src/Makefile.in diff --git a/eglib/ChangeLog b/eglib/ChangeLog index a011b4bcce0..f48a3677c59 100644 --- a/eglib/ChangeLog +++ b/eglib/ChangeLog @@ -1,3 +1,15 @@ +2006-08-16 Aaron Bockover + + * src/gstr.c: Added g_strsplit implementation + + * test/driver.c: Run the split test + + * test/str.c: Added a test for g_strsplit + + * Makefile.am: + * src/Makefile.am: + * test/Makefile.am: Added MAINTAINERCLEANFILES + 2006-08-16 Miguel de Icaza * src/gouput.c: Implement some output routines, update missing diff --git a/eglib/Makefile.am b/eglib/Makefile.am index 383b168c410..732d9e657a8 100644 --- a/eglib/Makefile.am +++ b/eglib/Makefile.am @@ -1,3 +1,22 @@ SUBDIRS = src test -EXTRA_DIST = autogen.sh README NEWS AUTHORS ChangeLog \ No newline at end of file +EXTRA_DIST = autogen.sh README NEWS AUTHORS ChangeLog + +MAINTAINERCLEANFILES = \ + compile \ + INSTALL \ + config.h.in \ + aclocal.m4 \ + ltmain.sh \ + Makefile.in \ + depcomp \ + missing \ + install-sh \ + configure \ + config.sub \ + config.guess \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in \ + mkinstalldirs + diff --git a/eglib/missing b/eglib/missing deleted file mode 100644 index 5c91eaaff50..00000000000 --- a/eglib/missing +++ /dev/null @@ -1,219 +0,0 @@ - -* Code that we will drop from Mono, because we do not really need this: - - Directory, File manipulation: - - g_dir_open, g_dir_close, g_dir_read_name, - G_FILE_ERROR_* - - These will be replaced in io-layer with direct Unix calls. - - These will be replaced in metadata with two code paths, native - Unix and native Windows. - - g_unichar_ - - We probably do not need these anymore, we should kill the unmanaged - string collation and just leave the unmanaged string collation in - place. - -Routines missing from eglib, by count number: - - 148 g_string_append - 103 g_string_sprintfa - 82 g_list_prepend - 59 g_list_free - 54 g_string_append_c - 49 g_string_new - 49 g_string_free - 36 g_ptr_array_index - 31 g_string_append_printf - 29 g_getenv - 28 g_module_symbol - 28 g_list_append - 27 g_build_filename - 25 g_slist_free - 24 g_utf16_to_utf8 - 22 g_strsplit - 22 g_list_length - 21 g_snprintf - 21 g_slist_prepend - 21 g_ptr_array_free - 21 g_ptr_array_add - 20 g_utf8_to_utf16 - 17 g_ptr_array_new - 16 g_list_delete_link - 15 g_list_remove - 14 g_memdup - 14 g_list_find - 13 g_error_free - 12 g_build_path - 11 g_module_open - 11 g_file_test - 10 g_strlcpy - 10 g_slist_append - 10 g_path_get_dirname - 10 g_ascii_xdigit_value - 10 g_ascii_isspace - 10 g_array_index - 9 g_path_get_basename - 8 g_module_error - 8 g_get_home_dir - 8 g_ascii_strncasecmp - 7 g_strcasecmp - 7 g_slist_remove - 7 g_slist_next - 7 g_list_reverse - 6 g_strstrip - 6 g_slist_find - 6 g_renew - 6 g_memmove - 6 g_io_channel_unix_get_fd - 5 g_timer_elapsed - 5 g_ptr_array_sort - 5 g_path_is_absolute - 5 g_newa - 5 g_module_build_path - 5 g_list_first - 5 g_get_current_dir - 5 g_file_get_contents - 5 g_ascii_strcasecmp - 4 g_unsetenv - 4 g_strdown - 4 g_slist_length - 4 g_get_tmp_dir - 3 g_utf8_validate - 3 g_thread_supported - 3 g_thread_init - 3 g_spaced_primes_closest - 3 g_slist_insert_sorted - 3 g_shell_quote - 3 g_setenv - 3 g_locale_to_utf8 - 3 g_list_prepend_mempool - 3 g_list_next - 3 g_list_insert_sorted - 3 g_list_insert_before - 3 g_list_foreach - 3 g_file_open_tmp - 3 g_convert - 3 g_array_new - 3 g_array_free - 2 g_timer_stop - 2 g_timer_start - 2 g_timer_new - 2 g_strreverse - 2 g_string_printf - 2 g_string_append_len - 2 g_strdelimit - 2 g_slist_remove_link - 2 g_slist_append_mempool - 2 g_slist_alloc - 2 g_shell_parse_argv - 2 g_set_prgname - 2 g_queue_pop_head - 2 g_queue_is_empty - 2 g_ptr_array_set_size - 2 g_ptr_array_remove - 2 g_printerr - 2 g_pattern_spec_new - 2 g_pattern_spec_free - 2 g_pattern_match_string - 2 g_markup_parse_context_parse - 2 g_markup_parse_context_new - 2 g_markup_parse_context_free - 2 g_markup_parse_context_end_parse - 2 g_list_sort - 2 g_list_index - 2 g_get_current_time - 2 g_find_program_in_path - 2 g_filename_to_uri - 2 g_filename_from_uri - 2 g_concat_dir_and_file - 2 g_atexit - 2 g_ascii_isalpha - 2 g_array_insert_val - 2 g_array_append_val - 2 g_alloca - 1 g_win32_getlocale - 1 g_timer_destroy - 1 g_strjoin - 1 g_string_truncate - 1 g_string_sized_new - 1 g_string_prepend - 1 g_string_new_len - 1 g_strescape - 1 g_strchug - 1 g_spawn_command_line_sync - 1 g_spawn_async_with_pipes - 1 g_source_unref - 1 g_source_set_callback - 1 g_source_remove - 1 g_source_attach - 1 g_slist_reverse - 1 g_slist_free_1 - 1 g_slist_delete_link - 1 g_shell_unquote - 1 g_queue_push_head - 1 g_queue_new - 1 g_queue_free - 1 g_module_close - 1 g_mem_set_vtable - 1 g_main_loop_run - 1 g_main_context_new - 1 g_main_context_iteration - 1 g_log_set_handler - 1 g_locale_from_utf8 - 1 g_list_remove_link - 1 g_list_nth - 1 g_list_copy - 1 g_io_create_watch - 1 g_io_channel_unref - 1 g_io_channel_unix_new - 1 g_io_channel_shutdown - 1 g_io_channel_set_encoding - 1 g_io_channel_set_buffered - 1 g_io_channel_get_buffer_condition - 1 g_io_add_watch - 1 g_get_user_name - 1 g_get_prgname - 1 g_get_charset - 1 g_filename_from_utf8 - 1 g_bit_nth_msf - 1 g_ascii_strdown - 1 g_ascii_isprint - 1 g_array_remove_index - -Macros: - 124 G_GNUC_PRETTY_FUNCTION - 40 G_GSIZE_FORMAT - 40 G_GNUC_UNUSED - 20 G_LITTLE_ENDIAN - 16 G_DIR_SEPARATOR_S - 12 G_BREAKPOINT - 11 G_MODULE_BIND_LAZY - 10 G_STMT_START - 10 G_STMT_END - 9 G_GUINT64_FORMAT - 7 G_FILE_TEST_IS_DIR - 6 G_UNLIKELY - 6 G_HASH_TABLE_RESIZE - 6 G_DIR_SEPARATOR - 5 G_UNLOCK - 5 G_LOCK - 4 G_LIKELY - 4 G_GNUC_NORETURN - 4 G_FILE_TEST_IS_REGULAR - 3 G_SEARCHPATH_SEPARATOR_S - 2 G_USEC_PER_SEC - 2 G_STRLOC - 2 G_IO_NVAL - 2 G_BIG_ENDIAN - 1 G_SPAWN_SEARCH_PATH - 1 G_IO_PRI - 1 G_ALLOC_ONLY - -Unlikely that we will implement: - - 2 g_unichar_type - 2 g_unichar_tolower diff --git a/eglib/src/Makefile.am b/eglib/src/Makefile.am index afbcd9ac6e7..eb4bf2af8a7 100644 --- a/eglib/src/Makefile.am +++ b/eglib/src/Makefile.am @@ -7,4 +7,7 @@ libeglib_la_SOURCES = \ INCLUDES = -I$(srcdir) -libeglib_la_LIBADD = -lm \ No newline at end of file +libeglib_la_LIBADD = -lm + +MAINTAINERCLEANFILES = Makefile.in + diff --git a/eglib/src/Makefile.in b/eglib/src/Makefile.in deleted file mode 100644 index c083e971357..00000000000 --- a/eglib/src/Makefile.in +++ /dev/null @@ -1,434 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = src -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libeglib_la_DEPENDENCIES = -am_libeglib_la_OBJECTS = ghashtable.lo goutput.lo gstr.lo -libeglib_la_OBJECTS = $(am_libeglib_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/../depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libeglib_la_SOURCES) -DIST_SOURCES = $(libeglib_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -noinst_LTLIBRARIES = libeglib.la -libeglib_la_SOURCES = \ - ghashtable.c \ - goutput.c \ - gstr.c - -INCLUDES = -I$(srcdir) -libeglib_la_LIBADD = -lm -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libeglib.la: $(libeglib_la_OBJECTS) $(libeglib_la_DEPENDENCIES) - $(LINK) $(libeglib_la_LDFLAGS) $(libeglib_la_OBJECTS) $(libeglib_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ghashtable.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/goutput.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstr.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/eglib/src/gstr.c b/eglib/src/gstr.c index cc2c93e7c7d..6a72c104139 100644 --- a/eglib/src/gstr.c +++ b/eglib/src/gstr.c @@ -3,6 +3,7 @@ * * Author: * Miguel de Icaza (miguel@novell.com) + * Aaron Bockover (abockover@novell.com) * * (C) 2006 Novell, Inc. * @@ -102,8 +103,55 @@ g_strconcat (const gchar *first, ...) return ret; } -gchar ** -g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens) +gchar ** +g_strsplit(const gchar *string, const gchar *delimiter, gint max_tokens) { - return NULL; + gchar *string_c; + gchar *strtok_save, **vector; + gchar *token, *token_c; + gint size = 1; + gint token_length; + + g_return_val_if_fail(string != NULL, NULL); + g_return_val_if_fail(delimiter != NULL, NULL); + g_return_val_if_fail(delimiter[0] != '\0', NULL); + + token_length = strlen(string); + string_c = (gchar *)g_malloc(token_length + 1); + strncpy(string_c, string, token_length); + string_c[token_length] = '\0'; + + vector = NULL; + token = (gchar *)strtok_r(string_c, delimiter, &strtok_save); + + while(token != NULL) { + token_length = strlen(token); + token_c = (gchar *)malloc(token_length + 1); + strncpy(token_c, token, token_length); + token_c[token_length] = '\0'; + + vector = vector == NULL ? + (gchar **)g_malloc(sizeof(vector)) : + (gchar **)g_realloc(vector, (size + 1) * sizeof(vector)); + + vector[size - 1] = token_c; + size++; + + if(max_tokens > 0 && size >= max_tokens) { + if(size > max_tokens) { + break; + } + + token = strtok_save; + } else { + token = (gchar *)strtok_r(NULL, delimiter, &strtok_save); + } + } + + vector[size - 1] = NULL; + g_free(string_c); + string_c = NULL; + + return vector; } + diff --git a/eglib/test/Makefile.am b/eglib/test/Makefile.am index 71414511b24..e11e1a8ae81 100644 --- a/eglib/test/Makefile.am +++ b/eglib/test/Makefile.am @@ -9,3 +9,6 @@ test_SOURCES = \ INCLUDES = -I../src test_LDADD = -L../src -leglib + +MAINTAINERCLEANFILES = Makefile.in + diff --git a/eglib/test/driver.c b/eglib/test/driver.c index 1dac1326ab0..856108d16c4 100644 --- a/eglib/test/driver.c +++ b/eglib/test/driver.c @@ -8,4 +8,5 @@ int main () test ("hash-1", hash_t1); test ("s-freev", test_strfreev); test ("s-concat", test_concat); + test ("s-split", test_split); } diff --git a/eglib/test/str.c b/eglib/test/str.c index 7e676c5c22f..b0cafee6718 100644 --- a/eglib/test/str.c +++ b/eglib/test/str.c @@ -25,3 +25,23 @@ test_concat () g_free (x); return NULL; } + +char * +test_split () +{ + gchar **v = g_strsplit("Hello world, how are we doing today?", " ", 0); + int i = 0; + + if(v == NULL) { + return g_strdup_printf("split failed, got NULL vector"); + } else { + for(i = 0; v[i] != NULL; i++); + if(i != 7) { + return g_strdup_printf("split failed, expected 7 tokens, got %d\n", i); + } + } + + g_strfreev(v); + return NULL; +} + -- 2.25.1