The following commit has been merged in the master branch: commit 98aea15132c085be3901956986afaa46bf0456b1 Author: Guillem Jover <guil...@debian.org> Date: Tue Aug 2 04:54:42 2011 +0200
libdpkg: Make parse_stanza() a public function Make public also the required parse helper macros and structures. At least parse_EOF() will be needed for other callers to get out of the loop when parsing multi-stanza files. diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c index 491d9dd..46f3528 100644 --- a/lib/dpkg/parse.c +++ b/lib/dpkg/parse.c @@ -93,15 +93,6 @@ static const struct nickname nicknames[] = { { .nick = NULL } }; -struct field_state { - const char *fieldstart; - const char *valuestart; - struct varbuf value; - int fieldlen; - int valuelen; - int *fieldencountered; -}; - /** * Parse the field and value into the package being constructed. */ @@ -311,17 +302,10 @@ pkg_parse_copy(struct parsedb_state *ps, } } -#define parse_EOF(ps) ((ps)->dataptr >= (ps)->endptr) -#define parse_getc(ps) *(ps)->dataptr++ -#define parse_ungetc(c, ps) (ps)->dataptr-- - -typedef void parse_field_func(struct parsedb_state *ps, struct field_state *fs, - struct pkginfo *pkg, struct pkgbin *pkgbin); - /** * Parse an RFC-822 style stanza. */ -static bool +bool parse_stanza(struct parsedb_state *ps, struct field_state *fs, parse_field_func *parse_field, struct pkginfo *pkg, struct pkgbin *pkgbin) diff --git a/lib/dpkg/parsedump.h b/lib/dpkg/parsedump.h index 08c34cd..12eb4ca 100644 --- a/lib/dpkg/parsedump.h +++ b/lib/dpkg/parsedump.h @@ -34,6 +34,26 @@ struct parsedb_state { int lno; }; +#define parse_EOF(ps) ((ps)->dataptr >= (ps)->endptr) +#define parse_getc(ps) *(ps)->dataptr++ +#define parse_ungetc(c, ps) (ps)->dataptr-- + +struct field_state { + const char *fieldstart; + const char *valuestart; + struct varbuf value; + int fieldlen; + int valuelen; + int *fieldencountered; +}; + +typedef void parse_field_func(struct parsedb_state *ps, struct field_state *fs, + struct pkginfo *pkg, struct pkgbin *pkgbin); + +bool parse_stanza(struct parsedb_state *ps, struct field_state *fs, + parse_field_func *parse_field, + struct pkginfo *pkg, struct pkgbin *pkgbin); + #define PKGIFPOFF(f) (offsetof(struct pkgbin, f)) #define PKGPFIELD(pifp,of,type) (*(type*)((char*)(pifp)+(of))) -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org