Commit 736e362a authored by rswindell's avatar rswindell
Browse files

Remove all the DLLCALL noise. We don't need it.

parent 27f55277
......@@ -41,7 +41,7 @@
#include "str_list.h"
#include "xpprintf.h"
str_list_t DLLCALL strListInit(void)
str_list_t strListInit(void)
{
str_list_t list;
......@@ -52,7 +52,7 @@ str_list_t DLLCALL strListInit(void)
return(list);
}
size_t DLLCALL strListCount(const str_list_t list)
size_t strListCount(const str_list_t list)
{
size_t i;
......@@ -61,12 +61,12 @@ size_t DLLCALL strListCount(const str_list_t list)
return(i);
}
BOOL DLLCALL strListIsEmpty(const str_list_t list)
BOOL strListIsEmpty(const str_list_t list)
{
return (list == NULL) || (list[0] == NULL);
}
int DLLCALL strListIndexOf(const str_list_t list, const char* str)
int strListIndexOf(const str_list_t list, const char* str)
{
size_t i;
......@@ -81,7 +81,7 @@ int DLLCALL strListIndexOf(const str_list_t list, const char* str)
return -1;
}
int DLLCALL strListFind(const str_list_t list, const char* str, BOOL case_sensistive)
int strListFind(const str_list_t list, const char* str, BOOL case_sensistive)
{
size_t i;
......@@ -139,7 +139,7 @@ static char* str_list_insert(str_list_t* list, char* str, size_t index)
return(str);
}
char* DLLCALL strListRemove(str_list_t* list, size_t index)
char* strListRemove(str_list_t* list, size_t index)
{
char* str;
size_t i;
......@@ -167,7 +167,7 @@ char* DLLCALL strListRemove(str_list_t* list, size_t index)
return(str);
}
BOOL DLLCALL strListDelete(str_list_t* list, size_t index)
BOOL strListDelete(str_list_t* list, size_t index)
{
char* str;
......@@ -179,7 +179,7 @@ BOOL DLLCALL strListDelete(str_list_t* list, size_t index)
return(TRUE);
}
char* DLLCALL strListReplace(const str_list_t list, size_t index, const char* str)
char* strListReplace(const str_list_t list, size_t index, const char* str)
{
char* buf;
size_t count;
......@@ -204,7 +204,7 @@ char* DLLCALL strListReplace(const str_list_t list, size_t index, const char* st
return(buf);
}
size_t DLLCALL strListModifyEach(const str_list_t list, char*(modify(size_t, char*, void*)), void* cbdata)
size_t strListModifyEach(const str_list_t list, char*(modify(size_t, char*, void*)), void* cbdata)
{
size_t i;
for(i = 0; list[i] != NULL; i++) {
......@@ -220,7 +220,7 @@ size_t DLLCALL strListModifyEach(const str_list_t list, char*(modify(size_t, cha
return i;
}
BOOL DLLCALL strListSwap(const str_list_t list, size_t index1, size_t index2)
BOOL strListSwap(const str_list_t list, size_t index1, size_t index2)
{
char* tmp;
size_t count;
......@@ -243,7 +243,7 @@ BOOL DLLCALL strListSwap(const str_list_t list, size_t index1, size_t index2)
return(TRUE);
}
char* DLLCALL strListAppend(str_list_t* list, const char* str, size_t index)
char* strListAppend(str_list_t* list, const char* str, size_t index)
{
char* buf;
char *ret;
......@@ -263,7 +263,7 @@ char* DLLCALL strListAppend(str_list_t* list, const char* str, size_t index)
return ret;
}
size_t DLLCALL strListAppendList(str_list_t* list, const str_list_t add_list)
size_t strListAppendList(str_list_t* list, const str_list_t add_list)
{
size_t i;
size_t count;
......@@ -276,7 +276,7 @@ size_t DLLCALL strListAppendList(str_list_t* list, const str_list_t add_list)
}
#if !defined(__BORLANDC__) // Doesn't have asprintf() or va_copy()_vscprintf()
char* DLLCALL strListAppendFormat(str_list_t* list, const char* format, ...)
char* strListAppendFormat(str_list_t* list, const char* format, ...)
{
char *ret;
char* buf = NULL;
......@@ -297,7 +297,7 @@ char* DLLCALL strListAppendFormat(str_list_t* list, const char* format, ...)
}
#endif
char* DLLCALL strListInsert(str_list_t* list, const char* str, size_t index)
char* strListInsert(str_list_t* list, const char* str, size_t index)
{
char* buf;
char* ret;
......@@ -314,7 +314,7 @@ char* DLLCALL strListInsert(str_list_t* list, const char* str, size_t index)
return ret;
}
size_t DLLCALL strListInsertList(str_list_t* list, const str_list_t add_list, size_t index)
size_t strListInsertList(str_list_t* list, const str_list_t add_list, size_t index)
{
size_t i;
......@@ -326,7 +326,7 @@ size_t DLLCALL strListInsertList(str_list_t* list, const str_list_t add_list, si
}
#if !defined(__BORLANDC__) // Doesn't have asprintf() or va_copy()_vscprintf()
char* DLLCALL strListInsertFormat(str_list_t* list, size_t index, const char* format, ...)
char* strListInsertFormat(str_list_t* list, size_t index, const char* format, ...)
{
char *ret;
char* buf = NULL;
......@@ -347,7 +347,7 @@ char* DLLCALL strListInsertFormat(str_list_t* list, size_t index, const char* fo
}
#endif
str_list_t DLLCALL strListSplit(str_list_t* lp, char* str, const char* delimit)
str_list_t strListSplit(str_list_t* lp, char* str, const char* delimit)
{
size_t count;
char* token;
......@@ -372,7 +372,7 @@ str_list_t DLLCALL strListSplit(str_list_t* lp, char* str, const char* delimit)
return(*lp);
}
str_list_t DLLCALL strListSplitCopy(str_list_t* list, const char* str, const char* delimit)
str_list_t strListSplitCopy(str_list_t* list, const char* str, const char* delimit)
{
char* buf;
str_list_t new_list;
......@@ -393,7 +393,7 @@ str_list_t DLLCALL strListSplitCopy(str_list_t* list, const char* str, const cha
return(new_list);
}
size_t DLLCALL strListMerge(str_list_t* list, str_list_t add_list)
size_t strListMerge(str_list_t* list, str_list_t add_list)
{
size_t i;
size_t count;
......@@ -405,7 +405,7 @@ size_t DLLCALL strListMerge(str_list_t* list, str_list_t add_list)
return(i);
}
char* DLLCALL strListCombine(str_list_t list, char* buf, size_t maxlen, const char* delimit)
char* strListCombine(str_list_t list, char* buf, size_t maxlen, const char* delimit)
{
size_t i;
char* end;
......@@ -455,27 +455,27 @@ static int QSORT_CALLBACK_TYPE strListCompareAlphaCaseReverse(const void *arg1,
return strcmp(*(char**)arg2, *(char**)arg1);
}
void DLLCALL strListSortAlpha(str_list_t list)
void strListSortAlpha(str_list_t list)
{
qsort(list,strListCount(list),sizeof(char*),strListCompareAlpha);
}
void DLLCALL strListSortAlphaReverse(str_list_t list)
void strListSortAlphaReverse(str_list_t list)
{
qsort(list,strListCount(list),sizeof(char*),strListCompareAlphaReverse);
}
void DLLCALL strListSortAlphaCase(str_list_t list)
void strListSortAlphaCase(str_list_t list)
{
qsort(list,strListCount(list),sizeof(char*),strListCompareAlphaCase);
}
void DLLCALL strListSortAlphaCaseReverse(str_list_t list)
void strListSortAlphaCaseReverse(str_list_t list)
{
qsort(list,strListCount(list),sizeof(char*),strListCompareAlphaCaseReverse);
}
str_list_t DLLCALL strListDup(str_list_t list)
str_list_t strListDup(str_list_t list)
{
str_list_t ret;
size_t count=0;
......@@ -486,7 +486,7 @@ str_list_t DLLCALL strListDup(str_list_t list)
return ret;
}
int DLLCALL strListCmp(str_list_t list1, str_list_t list2)
int strListCmp(str_list_t list1, str_list_t list2)
{
str_list_t l1=strListDup(list1);
str_list_t l2=strListDup(list2);
......@@ -535,14 +535,14 @@ early_return:
return ret;
}
void DLLCALL strListFreeStrings(str_list_t list)
void strListFreeStrings(str_list_t list)
{
size_t i;
FREE_LIST_ITEMS(list,i);
}
void DLLCALL strListFree(str_list_t* list)
void strListFree(str_list_t* list)
{
if(list != NULL && *list != NULL) {
strListFreeStrings(*list);
......@@ -582,7 +582,7 @@ static str_list_t str_list_read_file(FILE* fp, str_list_t* lp, size_t max_line_l
return(*lp);
}
size_t DLLCALL strListInsertFile(FILE* fp, str_list_t* lp, size_t index, size_t max_line_len)
size_t strListInsertFile(FILE* fp, str_list_t* lp, size_t index, size_t max_line_len)
{
str_list_t list;
size_t count;
......@@ -597,12 +597,12 @@ size_t DLLCALL strListInsertFile(FILE* fp, str_list_t* lp, size_t index, size_t
return(count);
}
str_list_t DLLCALL strListReadFile(FILE* fp, str_list_t* lp, size_t max_line_len)
str_list_t strListReadFile(FILE* fp, str_list_t* lp, size_t max_line_len)
{
return str_list_read_file(fp,lp,max_line_len);
}
size_t DLLCALL strListWriteFile(FILE* fp, const str_list_t list, const char* separator)
size_t strListWriteFile(FILE* fp, const str_list_t list, const char* separator)
{
size_t i;
......@@ -644,7 +644,7 @@ char* strListJoin(const str_list_t list, char* buf, size_t buflen, const char* s
return buf;
}
size_t DLLCALL strListBlockLength(char* block)
size_t strListBlockLength(char* block)
{
char* p=block;
size_t str_len;
......@@ -666,7 +666,7 @@ size_t DLLCALL strListBlockLength(char* block)
return(block_len);
}
char* DLLCALL strListCopyBlock(char* block)
char* strListCopyBlock(char* block)
{
char* p;
size_t block_len;
......@@ -680,7 +680,7 @@ char* DLLCALL strListCopyBlock(char* block)
return(p);
}
char* DLLCALL strListAppendBlock(char* block, str_list_t list)
char* strListAppendBlock(char* block, str_list_t list)
{
char* p;
size_t str_len;
......@@ -717,18 +717,18 @@ char* DLLCALL strListAppendBlock(char* block, str_list_t list)
return(block);
}
char* DLLCALL strListCreateBlock(str_list_t list)
char* strListCreateBlock(str_list_t list)
{
return(strListAppendBlock(NULL,list));
}
void DLLCALL strListFreeBlock(char* block)
void strListFreeBlock(char* block)
{
if(block!=NULL)
free(block); /* this must be done here for Windows-DLL reasons */
}
int DLLCALL strListTruncateTrailingWhitespaces(str_list_t list)
int strListTruncateTrailingWhitespaces(str_list_t list)
{
size_t i;
......@@ -741,7 +741,7 @@ int DLLCALL strListTruncateTrailingWhitespaces(str_list_t list)
return i;
}
int DLLCALL strListTruncateTrailingLineEndings(str_list_t list)
int strListTruncateTrailingLineEndings(str_list_t list)
{
size_t i;
......@@ -754,9 +754,8 @@ int DLLCALL strListTruncateTrailingLineEndings(str_list_t list)
return i;
}
/* Truncate strings in list at first occurrence of any char in 'set' */
int DLLCALL strListTruncateStrings(str_list_t list, const char* set)
int strListTruncateStrings(str_list_t list, const char* set)
{
size_t i;
char* p;
......
......@@ -52,49 +52,49 @@ extern "C" {
typedef char** str_list_t;
/* Returns an allocated and terminated string list */
DLLEXPORT str_list_t DLLCALL strListInit(void);
DLLEXPORT str_list_t strListInit(void);
/* Frees the strings in the list (and the list itself) */
DLLEXPORT void DLLCALL strListFree(str_list_t*);
DLLEXPORT void strListFree(str_list_t*);
/* Frees the strings in the list */
DLLEXPORT void DLLCALL strListFreeStrings(str_list_t);
DLLEXPORT void strListFreeStrings(str_list_t);
/* Adds a string to the end of a string list (see strListPush) */
/* Pass a pointer to a string list, the string to add (append) */
/* The string to add is duplicated (using strdup) and the duplicate is added to the list */
/* If you already know the index of the last string, pass it, otherwise pass STR_LIST_LAST_INDEX */
/* Returns the updated list or NULL on error */
DLLEXPORT char* DLLCALL strListAppend(str_list_t*, const char* str, size_t index);
DLLEXPORT char* strListAppend(str_list_t*, const char* str, size_t index);
/* Append a string list onto another string list */
DLLEXPORT size_t DLLCALL strListAppendList(str_list_t*, const str_list_t append_list);
DLLEXPORT size_t strListAppendList(str_list_t*, const str_list_t append_list);
/* Append a malloc'd formatted string to the end of the list */
DLLEXPORT char* DLLCALL strListAppendFormat(str_list_t* list, const char* format, ...);
DLLEXPORT char* strListAppendFormat(str_list_t* list, const char* format, ...);
/* Inserts a string into the list at a specific index */
/* Pass a pointer to a string list, the string to add (insert) */
/* The string to add is duplicated (using strdup) and the duplicate is added to the list */
DLLEXPORT char* DLLCALL strListInsert(str_list_t*, const char* str, size_t index);
DLLEXPORT char* strListInsert(str_list_t*, const char* str, size_t index);
/* Insert a string list into another string list */
DLLEXPORT size_t DLLCALL strListInsertList(str_list_t*, const str_list_t append_list, size_t index);
DLLEXPORT size_t strListInsertList(str_list_t*, const str_list_t append_list, size_t index);
/* Insert a malloc'd formatted string into the list */
DLLEXPORT char* DLLCALL strListInsertFormat(str_list_t* list, size_t index, const char* format, ...);
DLLEXPORT char* strListInsertFormat(str_list_t* list, size_t index, const char* format, ...);
/* Remove a string at a specific index */
DLLEXPORT char* DLLCALL strListRemove(str_list_t*, size_t index);
DLLEXPORT char* strListRemove(str_list_t*, size_t index);
/* Remove and free a string at a specific index */
DLLEXPORT BOOL DLLCALL strListDelete(str_list_t*, size_t index);
DLLEXPORT BOOL strListDelete(str_list_t*, size_t index);
/* Replace a string at a specific index */
DLLEXPORT char* DLLCALL strListReplace(const str_list_t, size_t index, const char* str);
DLLEXPORT char* strListReplace(const str_list_t, size_t index, const char* str);
/* Return a single-string representation of the entire string list, joined with the specified separator */
DLLEXPORT char* DLLCALL strListJoin(const str_list_t, char* buf, size_t buflen, const char* separator);
DLLEXPORT char* strListJoin(const str_list_t, char* buf, size_t buflen, const char* separator);
/* Call a modification callback function for each string in a list */
/* and replace each string with the result of the modification callback. */
......@@ -104,10 +104,10 @@ DLLEXPORT char* DLLCALL strListJoin(const str_list_t, char* buf, size_t buflen,
/* (possibly, the cbdata, a global array or a static automatic variable). Since the new pointer is not free'd here, it should */
/* not be dynamically allocated by the callback function. */
/* Returns the number of modified strings (normally, the list count unless there was a failure) */
DLLEXPORT size_t DLLCALL strListModifyEach(const str_list_t list, char*(modify(size_t index, char* str, void*)), void* cbdata);
DLLEXPORT size_t strListModifyEach(const str_list_t list, char*(modify(size_t index, char* str, void*)), void* cbdata);
/* Swap the strings at index1 and index2 */
DLLEXPORT BOOL DLLCALL strListSwap(const str_list_t, size_t index1, size_t index2);
DLLEXPORT BOOL strListSwap(const str_list_t, size_t index1, size_t index2);
/* Convenience macros for pushing, popping strings (LIFO stack) */
#define strListPush(list, str) strListAppend(list, str, STR_LIST_LAST_INDEX)
......@@ -115,55 +115,55 @@ DLLEXPORT BOOL DLLCALL strListSwap(const str_list_t, size_t index1, size_t inde
/* Add to an exiting or new string list by splitting specified string (str) */
/* into multiple strings, separated by one of the delimit characters */
DLLEXPORT str_list_t DLLCALL strListSplit(str_list_t*, char* str, const char* delimit);
DLLEXPORT str_list_t strListSplit(str_list_t*, char* str, const char* delimit);
/* Same as above, but copies str to temporary heap buffer first */
DLLEXPORT str_list_t DLLCALL strListSplitCopy(str_list_t*, const char* str, const char* delimit);
DLLEXPORT str_list_t strListSplitCopy(str_list_t*, const char* str, const char* delimit);
/* Merge 2 string lists (no copying of string data) */
DLLEXPORT size_t DLLCALL strListMerge(str_list_t*, str_list_t append_list);
DLLEXPORT size_t strListMerge(str_list_t*, str_list_t append_list);
/* Create a single delimited string from the specified list */
/* If buf is NULL, the buf is malloc'd and should be freed using strListFreeBlock() */
/* Note: maxlen includes '\0' terminator */
DLLEXPORT char* DLLCALL strListCombine(str_list_t, char* buf, size_t maxlen, const char* delimit);
DLLEXPORT char* strListCombine(str_list_t, char* buf, size_t maxlen, const char* delimit);
/* Count the number of strings in the list and returns the count */
DLLEXPORT size_t DLLCALL strListCount(const str_list_t);
DLLEXPORT BOOL DLLCALL strListIsEmpty(const str_list_t);
DLLEXPORT size_t strListCount(const str_list_t);
DLLEXPORT BOOL strListIsEmpty(const str_list_t);
/* Returns the index of the specified str (by ptr compare) or -1 if not found */
DLLEXPORT int DLLCALL strListIndexOf(const str_list_t, const char* str);
DLLEXPORT int strListIndexOf(const str_list_t, const char* str);
/* Returns the index of the specified str (by string compare) or -1 if not found */
DLLEXPORT int DLLCALL strListFind(const str_list_t, const char* str, BOOL case_sensitive);
DLLEXPORT int strListFind(const str_list_t, const char* str, BOOL case_sensitive);
/* Sort the strings in the string list */
DLLEXPORT void DLLCALL strListSortAlpha(str_list_t);
DLLEXPORT void DLLCALL strListSortAlphaReverse(str_list_t);
DLLEXPORT void strListSortAlpha(str_list_t);
DLLEXPORT void strListSortAlphaReverse(str_list_t);
/* Case-sensitive sorting */
DLLEXPORT void DLLCALL strListSortAlphaCase(str_list_t);
DLLEXPORT void DLLCALL strListSortAlphaCaseReverse(str_list_t);
DLLEXPORT void strListSortAlphaCase(str_list_t);
DLLEXPORT void strListSortAlphaCaseReverse(str_list_t);
/* Create/Copy/Append/Free NULL-terminated string block */
/* (e.g. for environment variable blocks) */
DLLEXPORT char* DLLCALL strListCreateBlock(str_list_t);
DLLEXPORT char* DLLCALL strListCopyBlock(char* block);
DLLEXPORT char* DLLCALL strListAppendBlock(char* block, str_list_t);
DLLEXPORT size_t DLLCALL strListBlockLength(char* block);
DLLEXPORT void DLLCALL strListFreeBlock(char*);
DLLEXPORT char* strListCreateBlock(str_list_t);
DLLEXPORT char* strListCopyBlock(char* block);
DLLEXPORT char* strListAppendBlock(char* block, str_list_t);
DLLEXPORT size_t strListBlockLength(char* block);
DLLEXPORT void strListFreeBlock(char*);
/* Duplicates a list */
DLLEXPORT str_list_t DLLCALL strListDup(str_list_t list);
DLLEXPORT str_list_t strListDup(str_list_t list);
/* Compares two lists */
DLLEXPORT int DLLCALL strListCmp(str_list_t list1, str_list_t list2);
DLLEXPORT int strListCmp(str_list_t list1, str_list_t list2);
/* Modifies strings in list (returns count of items in list) */
DLLEXPORT int DLLCALL strListTruncateTrailingWhitespaces(str_list_t);
DLLEXPORT int DLLCALL strListTruncateTrailingLineEndings(str_list_t);
DLLEXPORT int strListTruncateTrailingWhitespaces(str_list_t);
DLLEXPORT int strListTruncateTrailingLineEndings(str_list_t);
/* Truncate strings in list at first occurrence of any char in 'set' */
DLLEXPORT int DLLCALL strListTruncateStrings(str_list_t, const char* set);
DLLEXPORT int strListTruncateStrings(str_list_t, const char* set);
/************/
/* File I/O */
......@@ -171,11 +171,11 @@ DLLEXPORT int DLLCALL strListTruncateStrings(str_list_t, const char* set);
/* Read lines from file appending each line (with '\n' char) to string list */
/* Pass NULL list to have list allocated for you */
DLLEXPORT str_list_t DLLCALL strListReadFile(FILE*, str_list_t*, size_t max_line_len);
DLLEXPORT size_t DLLCALL strListInsertFile(FILE*, str_list_t*, size_t index, size_t max_line_len);
DLLEXPORT str_list_t strListReadFile(FILE*, str_list_t*, size_t max_line_len);
DLLEXPORT size_t strListInsertFile(FILE*, str_list_t*, size_t index, size_t max_line_len);
/* Write to file (fp) each string in the list, optionally separated by separator (e.g. "\n") */
DLLEXPORT size_t DLLCALL strListWriteFile(FILE*, const str_list_t, const char* separator);
DLLEXPORT size_t strListWriteFile(FILE*, const str_list_t, const char* separator);
#if defined(__cplusplus)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment