aboutsummaryrefslogtreecommitdiffstats
path: root/lib/parser.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2007-05-03 06:10:39 -0400
committerDavid S. Miller <davem@davemloft.net>2007-05-03 06:10:39 -0400
commitef4533f8af7a8798cb8f52b06f47acf0c0d2d767 (patch)
tree446b3db739812391f0e476550b2e04161d126bff /lib/parser.c
parent709525fad8a925de16938caf7fce3bf601ef869c (diff)
[AFS]: Make the match_*() functions take const options.
Make the match_*() functions take a const pointer to the options table and make strings pointers in the options table const too. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib/parser.c')
-rw-r--r--lib/parser.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/parser.c b/lib/parser.c
index 7ad2a48abc5e..703c8c13b346 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -22,7 +22,7 @@
22 * match extremely simple token=arg style patterns. If the pattern is found, 22 * match extremely simple token=arg style patterns. If the pattern is found,
23 * the location(s) of the arguments will be returned in the @args array. 23 * the location(s) of the arguments will be returned in the @args array.
24 */ 24 */
25static int match_one(char *s, char *p, substring_t args[]) 25static int match_one(char *s, const char *p, substring_t args[])
26{ 26{
27 char *meta; 27 char *meta;
28 int argc = 0; 28 int argc = 0;
@@ -43,7 +43,7 @@ static int match_one(char *s, char *p, substring_t args[])
43 p = meta + 1; 43 p = meta + 1;
44 44
45 if (isdigit(*p)) 45 if (isdigit(*p))
46 len = simple_strtoul(p, &p, 10); 46 len = simple_strtoul(p, (char **) &p, 10);
47 else if (*p == '%') { 47 else if (*p == '%') {
48 if (*s++ != '%') 48 if (*s++ != '%')
49 return 0; 49 return 0;
@@ -102,7 +102,7 @@ static int match_one(char *s, char *p, substring_t args[])
102 */ 102 */
103int match_token(char *s, match_table_t table, substring_t args[]) 103int match_token(char *s, match_table_t table, substring_t args[])
104{ 104{
105 struct match_token *p; 105 const struct match_token *p;
106 106
107 for (p = table; !match_one(s, p->pattern, args) ; p++) 107 for (p = table; !match_one(s, p->pattern, args) ; p++)
108 ; 108 ;
@@ -190,7 +190,7 @@ int match_hex(substring_t *s, int *result)
190 * &substring_t @s to the c-style string @to. Caller guarantees that @to is 190 * &substring_t @s to the c-style string @to. Caller guarantees that @to is
191 * large enough to hold the characters of @s. 191 * large enough to hold the characters of @s.
192 */ 192 */
193void match_strcpy(char *to, substring_t *s) 193void match_strcpy(char *to, const substring_t *s)
194{ 194{
195 memcpy(to, s->from, s->to - s->from); 195 memcpy(to, s->from, s->to - s->from);
196 to[s->to - s->from] = '\0'; 196 to[s->to - s->from] = '\0';
@@ -204,7 +204,7 @@ void match_strcpy(char *to, substring_t *s)
204 * the &substring_t @s. The caller is responsible for freeing the returned 204 * the &substring_t @s. The caller is responsible for freeing the returned
205 * string with kfree(). 205 * string with kfree().
206 */ 206 */
207char *match_strdup(substring_t *s) 207char *match_strdup(const substring_t *s)
208{ 208{
209 char *p = kmalloc(s->to - s->from + 1, GFP_KERNEL); 209 char *p = kmalloc(s->to - s->from + 1, GFP_KERNEL);
210 if (p) 210 if (p)