Make arguments for enumerator_create_token|directory const

This commit is contained in:
Tobias Brunner
2012-09-13 15:42:38 +02:00
parent 8c2ec47149
commit 1962e12fd3
2 changed files with 10 additions and 7 deletions
+7 -5
View File
@@ -121,7 +121,7 @@ static bool enumerate_dir_enum(dir_enum_t *this, char **relative,
/** /**
* See header * See header
*/ */
enumerator_t* enumerator_create_directory(char *path) enumerator_t* enumerator_create_directory(const char *path)
{ {
int len; int len;
dir_enum_t *this = malloc_thing(dir_enum_t); dir_enum_t *this = malloc_thing(dir_enum_t);
@@ -168,9 +168,9 @@ typedef struct {
/** current position */ /** current position */
char *pos; char *pos;
/** separater chars */ /** separater chars */
char *sep; const char *sep;
/** trim chars */ /** trim chars */
char *trim; const char *trim;
} token_enum_t; } token_enum_t;
/** /**
@@ -187,7 +187,8 @@ static void destroy_token_enum(token_enum_t *this)
*/ */
static bool enumerate_token_enum(token_enum_t *this, char **token) static bool enumerate_token_enum(token_enum_t *this, char **token)
{ {
char *pos = NULL, *tmp, *sep, *trim; const char *sep, *trim;
char *pos = NULL, *tmp;
bool last = FALSE; bool last = FALSE;
/* trim leading characters/separators */ /* trim leading characters/separators */
@@ -303,7 +304,8 @@ static bool enumerate_token_enum(token_enum_t *this, char **token)
/** /**
* See header * See header
*/ */
enumerator_t* enumerator_create_token(char *string, char *sep, char *trim) enumerator_t* enumerator_create_token(const char *string, const char *sep,
const char *trim)
{ {
token_enum_t *enumerator = malloc_thing(token_enum_t); token_enum_t *enumerator = malloc_thing(token_enum_t);
+3 -2
View File
@@ -93,7 +93,7 @@ enumerator_t *enumerator_create_single(void *item, void (*cleanup)(void *item));
* @param path path of the directory * @param path path of the directory
* @return the directory enumerator, NULL on failure * @return the directory enumerator, NULL on failure
*/ */
enumerator_t* enumerator_create_directory(char *path); enumerator_t* enumerator_create_directory(const char *path);
/** /**
* Create an enumerator over tokens of a string. * Create an enumerator over tokens of a string.
@@ -106,7 +106,8 @@ enumerator_t* enumerator_create_directory(char *path);
* @param trim characters to trim from tokens * @param trim characters to trim from tokens
* @return enumerator over char* tokens * @return enumerator over char* tokens
*/ */
enumerator_t* enumerator_create_token(char *string, char *sep, char *trim); enumerator_t* enumerator_create_token(const char *string, const char *sep,
const char *trim);
/** /**
* Creates an enumerator which enumerates over enumerated enumerators :-). * Creates an enumerator which enumerates over enumerated enumerators :-).