From: Pierre-Marc Fournier Date: Fri, 29 Jan 2010 04:44:19 +0000 (-0500) Subject: libustcomm: change char * to const char * where relevant X-Git-Tag: v0.2~42 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7e92827db5195a5b6afc110d0152eb2deef75638;p=ust.git libustcomm: change char * to const char * where relevant --- diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c index 6ddd6d8..fd5e360 100644 --- a/libustcomm/ustcomm.c +++ b/libustcomm/ustcomm.c @@ -612,7 +612,7 @@ void ustcomm_fini_app(struct ustcomm_app *handle) } } -static char *find_tok(char *str) +static const char *find_tok(const char *str) { while(*str == ' ') { str++; @@ -624,7 +624,7 @@ static char *find_tok(char *str) return str; } -static char *find_sep(char *str) +static const char *find_sep(const char *str) { while(*str != ' ') { str++; @@ -636,11 +636,11 @@ static char *find_sep(char *str) return str; } -int nth_token_is(char *str, char *token, int tok_no) +int nth_token_is(const char *str, const char *token, int tok_no) { int i; - char *start; - char *end; + const char *start; + const char *end; for(i=0; i<=tok_no; i++) { str = find_tok(str); @@ -665,12 +665,12 @@ int nth_token_is(char *str, char *token, int tok_no) return 1; } -char *nth_token(char *str, int tok_no) +char *nth_token(const char *str, int tok_no) { static char *retval = NULL; int i; - char *start; - char *end; + const char *start; + const char *end; for(i=0; i<=tok_no; i++) { str = find_tok(str); diff --git a/libustcomm/ustcomm.h b/libustcomm/ustcomm.h index 564ecac..2508838 100644 --- a/libustcomm/ustcomm.h +++ b/libustcomm/ustcomm.h @@ -74,9 +74,9 @@ extern int ustcomm_send_reply(struct ustcomm_server *server, char *msg, struct u extern int ustcomm_disconnect(struct ustcomm_connection *conn); extern int ustcomm_close_all_connections(struct ustcomm_server *server); -extern int nth_token_is(char *str, char *token, int tok_no); +extern int nth_token_is(const char *str, const char *token, int tok_no); -extern char *nth_token(char *str, int tok_no); +extern char *nth_token(const char *str, int tok_no); extern int pid_is_online(pid_t);