From: Jo-Philipp Wich Date: Wed, 15 Mar 2017 00:21:03 +0000 (+0100) Subject: pkg_parse: remove const requirement from pkg_parse_line() X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1654bcc09d4dd40c492447161103578abb69d500;p=oweals%2Fopkg-lede.git pkg_parse: remove const requirement from pkg_parse_line() 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 --- diff --git a/libopkg/parse_util.h b/libopkg/parse_util.h index 6b7d499..787750f 100644 --- a/libopkg/parse_util.h +++ b/libopkg/parse_util.h @@ -1,7 +1,7 @@ /* 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 @@ -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); -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); diff --git a/libopkg/pkg_parse.c b/libopkg/pkg_parse.c index 7017a06..adc4e5e 100644 --- a/libopkg/pkg_parse.c +++ b/libopkg/pkg_parse.c @@ -112,7 +112,7 @@ static char *parse_architecture(pkg_t *pkg, const char *str) 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; diff --git a/libopkg/pkg_parse.h b/libopkg/pkg_parse.h index 5f999f8..ac8d7c0 100644 --- a/libopkg/pkg_parse.h +++ b/libopkg/pkg_parse.h @@ -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 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)