Update to 3.4-final.
[linux-flexiantxendom0-3.2.10.git] / lib / parser.c
index 246f29a..c434100 100644 (file)
@@ -6,14 +6,15 @@
  */
 
 #include <linux/ctype.h>
-#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/export.h>
 #include <linux/parser.h>
 #include <linux/slab.h>
 #include <linux/string.h>
 
 /**
  * match_one: - Determines if a string matches a simple pattern
- * @s: the string to examine for presense of the pattern
+ * @s: the string to examine for presence of the pattern
  * @p: the string containing the pattern
  * @args: array of %MAX_OPT_ARGS &substring_t elements. Used to return match
  * locations.
@@ -114,19 +115,6 @@ int match_token(char *s, const match_table_t table, substring_t args[])
 }
 
 /**
- * match_string: check for a particular parameter
- * @s: substring to be scanned
- * @str: string to scan for
- *
- * Description: Return if a &substring_t is equal to string @str.
- */
-int match_string(substring_t *s, const char *str)
-{
-       return strlen(str) == s->to - s->from &&
-              !memcmp(str, s->from, s->to - s->from);
-}
-
-/**
  * match_number: scan a number in the given base from a substring_t
  * @s: substring to be scanned
  * @result: resulting integer on success
@@ -141,12 +129,13 @@ static int match_number(substring_t *s, int *result, int base)
        char *endp;
        char *buf;
        int ret;
+       size_t len = s->to - s->from;
 
-       buf = kmalloc(s->to - s->from + 1, GFP_KERNEL);
+       buf = kmalloc(len + 1, GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
-       memcpy(buf, s->from, s->to - s->from);
-       buf[s->to - s->from] = '\0';
+       memcpy(buf, s->from, len);
+       buf[len] = '\0';
        *result = simple_strtol(buf, &endp, base);
        ret = 0;
        if (endp == buf)
@@ -237,7 +226,6 @@ char *match_strdup(const substring_t *s)
 }
 
 EXPORT_SYMBOL(match_token);
-EXPORT_SYMBOL(match_string);
 EXPORT_SYMBOL(match_int);
 EXPORT_SYMBOL(match_octal);
 EXPORT_SYMBOL(match_hex);