summaryrefslogtreecommitdiffstats
path: root/libopkg/pkg_parse.h
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-10 22:18:23 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-10 22:18:23 (EST)
commitf547c5906e484a05abb12b2a3f5d704c3cf7b60f (patch)
tree5b638c19bc09ec6902f6b2205e6c9051d11bc970 /libopkg/pkg_parse.h
parent774828dbef307f77e5db18a81edd4afa23af80d9 (diff)
Cleanup parsing of packages.
This diff is loosely based on a patch by Jo-Philipp Wich <google@wwsnet.net> posted in the bugtracker (Issue #24). Peak memory consumption while parsing package lists is dramatically reduced. Thanks to Camille Moncelier for fixing problems after reallocing for long lines. git-svn-id: http://opkg.googlecode.com/svn/trunk@283 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/pkg_parse.h')
-rw-r--r--libopkg/pkg_parse.h45
1 files changed, 36 insertions, 9 deletions
diff --git a/libopkg/pkg_parse.h b/libopkg/pkg_parse.h
index 58e530a..5461607 100644
--- a/libopkg/pkg_parse.h
+++ b/libopkg/pkg_parse.h
@@ -18,14 +18,41 @@
#ifndef PKG_PARSE_H
#define PKG_PARSE_H
-int isGenericFieldType(char * type, char * line);
-char * parseGenericFieldType(char * type, char * raw);
-void parseStatus(pkg_t *pkg, char * raw);
-int parseVersion(pkg_t *pkg, char *raw);
-char ** parseDependsString(char * raw, int * depends_count);
-int parseVersion(pkg_t *pkg, char *raw);
-void parseConffiles(pkg_t * pkg, char * raw);
-int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest);
-int pkg_valorize_other_field(pkg_t *pkg, char ***raw);
+int parseVersion(pkg_t *pkg, const char *raw);
+int pkg_parse_from_stream(pkg_t *pkg, FILE *fp, uint mask);
+int pkg_parse_from_stream_nomalloc(pkg_t *pkg, FILE *fp, uint mask,
+ char **buf0, size_t buf0len);
+
+#define EXCESSIVE_LINE_LEN (4096 << 8)
+
+/* package field mask */
+#define PFM_ARCHITECTURE (1 << 1)
+#define PFM_AUTO_INSTALLED (1 << 2)
+#define PFM_CONFFILES (1 << 3)
+#define PFM_CONFLICTS (1 << 4)
+#define PFM_DESCRIPTION (1 << 5)
+#define PFM_DEPENDS (1 << 6)
+#define PFM_ESSENTIAL (1 << 7)
+#define PFM_FILENAME (1 << 8)
+#define PFM_INSTALLED_SIZE (1 << 9)
+#define PFM_INSTALLED_TIME (1 << 10)
+#define PFM_MD5SUM (1 << 11)
+#define PFM_MAINTAINER (1 << 12)
+#define PFM_PACKAGE (1 << 13)
+#define PFM_PRIORITY (1 << 14)
+#define PFM_PROVIDES (1 << 15)
+#define PFM_PRE_DEPENDS (1 << 16)
+#define PFM_RECOMMENDS (1 << 17)
+#define PFM_REPLACES (1 << 18)
+#define PFM_SECTION (1 << 19)
+#define PFM_SHA256SUM (1 << 20)
+#define PFM_SIZE (1 << 21)
+#define PFM_SOURCE (1 << 22)
+#define PFM_STATUS (1 << 23)
+#define PFM_SUGGESTS (1 << 24)
+#define PFM_TAGS (1 << 25)
+#define PFM_VERSION (1 << 26)
+
+#define PFM_ALL (~(uint)0)
#endif