pkg_parse: remove const requirement from pkg_parse_line()
authorJo-Philipp Wich <jo@mein.io>
Wed, 15 Mar 2017 00:21:03 +0000 (01:21 +0100)
committerJo-Philipp Wich <jo@mein.io>
Wed, 15 Mar 2017 00:42:49 +0000 (01:42 +0100)
To simplify parsing we'd like to be able to modify the passed line buffer
inplace, so remove the const requirement from the pkg_parse_line() argument.

Convert pkg_parse_line's sole user accordingly.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/parse_util.h
libopkg/pkg_parse.c
libopkg/pkg_parse.h

index 6b7d4993ef0fe4c91abd3355a3fc8ae10928f5d0..787750f00273b0a51a82e13301073f74c54239ff 100644 (file)
@@ -1,7 +1,7 @@
 /* parse_util.h - the opkg package management system
 
    Steven M. Ayer
 /* parse_util.h - the opkg package management system
 
    Steven M. Ayer
-   
+
    Copyright (C) 2002 Compaq Computer Corporation
 
    This program is free software; you can redistribute it and/or
    Copyright (C) 2002 Compaq Computer Corporation
 
    This program is free software; you can redistribute it and/or
@@ -23,7 +23,7 @@ char *parse_simple(const char *type, const char *line);
 char **parse_list(const char *raw, unsigned int *count, const char sep,
                  int skip_field);
 
 char **parse_list(const char *raw, unsigned int *count, const char sep,
                  int skip_field);
 
-typedef int (*parse_line_t) (void *, const char *, uint);
+typedef int (*parse_line_t) (void *, char *, uint);
 int parse_from_stream_nomalloc(parse_line_t parse_line, void *item, FILE * fp,
                               uint mask, char **buf0, size_t buf0len);
 
 int parse_from_stream_nomalloc(parse_line_t parse_line, void *item, FILE * fp,
                               uint mask, char **buf0, size_t buf0len);
 
index 7017a06b6f10af45d562fcae68225f0bc21bb3c9..adc4e5ea9d0d73d28a0d6e61be781eec207dc43f 100644 (file)
@@ -112,7 +112,7 @@ static char *parse_architecture(pkg_t *pkg, const char *str)
        return pkg_set_architecture(pkg, s, e - s);
 }
 
        return pkg_set_architecture(pkg, s, e - s);
 }
 
-int pkg_parse_line(void *ptr, const char *line, uint mask)
+int pkg_parse_line(void *ptr, char *line, uint mask)
 {
        pkg_t *pkg = (pkg_t *) ptr;
        abstract_pkg_t *ab_pkg = NULL;
 {
        pkg_t *pkg = (pkg_t *) ptr;
        abstract_pkg_t *ab_pkg = NULL;
index 5f999f88bf466f2ca87fa30dd925c7126baeeae7..ac8d7c05080d2abcf1cdca9ad70ae29f325aef66 100644 (file)
@@ -22,7 +22,7 @@
 
 int parse_version(pkg_t * pkg, const char *raw);
 int pkg_parse_from_stream(pkg_t * pkg, FILE * fp, uint mask);
 
 int parse_version(pkg_t * pkg, const char *raw);
 int pkg_parse_from_stream(pkg_t * pkg, FILE * fp, uint mask);
-int pkg_parse_line(void *ptr, const char *line, uint mask);
+int pkg_parse_line(void *ptr, char *line, uint mask);
 
 #define EXCESSIVE_LINE_LEN     (4096 << 8)
 
 
 #define EXCESSIVE_LINE_LEN     (4096 << 8)