From c455e68e61946394f1e4078efeffc87c65dff921 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 28 Apr 2020 10:06:08 -0400 Subject: Improved strlist: * Use strto*() functions instead of ato*() * Add _cmp and _copy functions * Removed compare functions * Replaced qsort call with strsort --- include/strlist.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/strlist.h b/include/strlist.h index 4cf76c6..919bdc1 100644 --- a/include/strlist.h +++ b/include/strlist.h @@ -29,6 +29,7 @@ unsigned short strlist_item_as_ushort(StrList *pStrList, size_t index); short strlist_item_as_short(StrList *pStrList, size_t index); unsigned char strlist_item_as_uchar(StrList *pStrList, size_t index); char strlist_item_as_char(StrList *pStrList, size_t index); +unsigned char strlist_item_as_uchar(StrList *pStrList, size_t index); char *strlist_item_as_str(StrList *pStrList, size_t index); char *strlist_item(StrList *pStrList, size_t index); void strlist_set(StrList *pStrList, size_t index, char *value); @@ -37,6 +38,8 @@ void strlist_reverse(StrList *pStrList); void strlist_sort(StrList *pStrList, unsigned int mode); void strlist_append_strlist(StrList *pStrList1, StrList *pStrList2); void strlist_append(StrList *pStrList, char *str); +StrList *strlist_copy(StrList *pStrList); +int strlist_cmp(StrList *a, StrList *b); void strlist_free(StrList *pStrList); #endif //SPM_STRLIST_H -- cgit From 64df149011bfd9a961493de31fe3f95376be280b Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 28 Apr 2020 13:55:54 -0400 Subject: Handle missing MAXFLOAT --- include/strlist.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/strlist.h b/include/strlist.h index 919bdc1..f887643 100644 --- a/include/strlist.h +++ b/include/strlist.h @@ -5,6 +5,10 @@ #ifndef SPM_STRLIST_H #define SPM_STRLIST_H +#if !defined(MAXFLOAT) +#include +#endif + typedef struct { size_t num_alloc; size_t num_inuse; -- cgit From 428849beb3be85cf69f3ca3029d330ee2f2d842f Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 28 Apr 2020 14:12:42 -0400 Subject: define MAXFLOAT if it is not already --- include/strlist.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'include') diff --git a/include/strlist.h b/include/strlist.h index f887643..e236473 100644 --- a/include/strlist.h +++ b/include/strlist.h @@ -5,20 +5,12 @@ #ifndef SPM_STRLIST_H #define SPM_STRLIST_H -#if !defined(MAXFLOAT) -#include -#endif - typedef struct { size_t num_alloc; size_t num_inuse; char **data; } StrList; -#define STRLIST_DEFAULT 1 << 0 -#define STRLIST_ASC 1 << 1 -#define STRLIST_DSC 1 << 2 - StrList *strlist_init(); long double strlist_item_as_long_double(StrList *pStrList, size_t index); double strlist_item_as_double(StrList *pStrList, size_t index); -- cgit