aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meson.build2
-rw-r--r--src/adb.h1
-rw-r--r--src/apk_adb.c22
-rw-r--r--src/app_adbdump.c2
-rw-r--r--src/app_convdb.c2
-rw-r--r--src/blob.c2
6 files changed, 20 insertions, 11 deletions
diff --git a/meson.build b/meson.build
index b30172d..ebc7648 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
project(
'apk-tools',
['c'],
- default_options : ['c_std=gnu99'],
+ default_options : ['c_std=gnu99', 'optimization=2'],
version: '3.0.0_pre0',
meson_version: '>=0.51'
)
diff --git a/src/adb.h b/src/adb.h
index 851aece..e4c2035 100644
--- a/src/adb.h
+++ b/src/adb.h
@@ -113,6 +113,7 @@ struct adb_object_schema {
struct adb_scalar_schema {
uint8_t kind;
+ uint8_t multiline : 1;
apk_blob_t (*tostring)(struct adb*, adb_val_t, char *, size_t);
adb_val_t (*fromstring)(struct adb*, apk_blob_t);
diff --git a/src/apk_adb.c b/src/apk_adb.c
index 3bd5827..2827733 100644
--- a/src/apk_adb.c
+++ b/src/apk_adb.c
@@ -102,6 +102,14 @@ static struct adb_scalar_schema scalar_string = {
.compare = string_compare,
};
+static struct adb_scalar_schema scalar_mstring = {
+ .kind = ADB_KIND_BLOB,
+ .multiline = 1,
+ .tostring = string_tostring,
+ .fromstring = string_fromstring,
+ .compare = string_compare,
+};
+
const struct adb_object_schema schema_string_array = {
.kind = ADB_KIND_ARRAY,
.num_fields = APK_MAX_PKG_TRIGGERS,
@@ -452,13 +460,13 @@ const struct adb_object_schema schema_scripts = {
.kind = ADB_KIND_OBJECT,
.num_fields = ADBI_SCRPT_MAX,
.fields = {
- ADB_FIELD(ADBI_SCRPT_TRIGGER, "trigger", scalar_string),
- ADB_FIELD(ADBI_SCRPT_PREINST, "pre-install", scalar_string),
- ADB_FIELD(ADBI_SCRPT_POSTINST, "post-install", scalar_string),
- ADB_FIELD(ADBI_SCRPT_PREDEINST, "pre-deinstall",scalar_string),
- ADB_FIELD(ADBI_SCRPT_POSTDEINST,"post-deinstall",scalar_string),
- ADB_FIELD(ADBI_SCRPT_PREUPGRADE,"pre-upgrade", scalar_string),
- ADB_FIELD(ADBI_SCRPT_POSTUPGRADE,"post-upgrade",scalar_string),
+ ADB_FIELD(ADBI_SCRPT_TRIGGER, "trigger", scalar_mstring),
+ ADB_FIELD(ADBI_SCRPT_PREINST, "pre-install", scalar_mstring),
+ ADB_FIELD(ADBI_SCRPT_POSTINST, "post-install", scalar_mstring),
+ ADB_FIELD(ADBI_SCRPT_PREDEINST, "pre-deinstall",scalar_mstring),
+ ADB_FIELD(ADBI_SCRPT_POSTDEINST,"post-deinstall",scalar_mstring),
+ ADB_FIELD(ADBI_SCRPT_PREUPGRADE,"pre-upgrade", scalar_mstring),
+ ADB_FIELD(ADBI_SCRPT_POSTUPGRADE,"post-upgrade",scalar_mstring),
},
};
diff --git a/src/app_adbdump.c b/src/app_adbdump.c
index 3914563..6e42a55 100644
--- a/src/app_adbdump.c
+++ b/src/app_adbdump.c
@@ -93,7 +93,7 @@ static void dump_item(struct adb_dump_ctx *ctx, const char *name, const uint8_t
if (!APK_BLOB_IS_NULL(b)) {
fputs(ctx->prefix, stdout);
if (name) fprintf(stdout, "%s: ", name);
- if (b.len >= 60 || apk_blob_chr(b, '\n')) {
+ if (b.len >= 60 || scalar->multiline) {
/* long or multiline */
apk_blob_t l;
fprintf(stdout, "|\n");
diff --git a/src/app_convdb.c b/src/app_convdb.c
index 5b5581e..39a8ad3 100644
--- a/src/app_convdb.c
+++ b/src/app_convdb.c
@@ -199,7 +199,7 @@ static int conv_main(void *pctx, struct apk_database *db, struct apk_string_arra
list_init(&ctx->script_head);
adb_w_init_alloca(&ctx->dbi, ADB_SCHEMA_INSTALLED_DB, 10);
- adb_w_init_alloca(&ctx->dbp, ADB_SCHEMA_PACKAGE, 100);
+ adb_w_init_alloca(&ctx->dbp, ADB_SCHEMA_PACKAGE, 1000);
adb_wo_alloca(&idb, &schema_idb, &ctx->dbi);
adb_wo_alloca(&ctx->pkgs, &schema_package_adb_array, &ctx->dbi);
diff --git a/src/blob.c b/src/blob.c
index 3a20439..aa7ca83 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -192,7 +192,7 @@ apk_blob_t apk_blob_pushed(apk_blob_t buffer, apk_blob_t left)
return APK_BLOB_PTR_LEN(buffer.ptr, left.ptr - buffer.ptr);
}
-static inline uint32_t rotl32(uint32_t x, int8_t r)
+static inline __attribute__((always_inline)) uint32_t rotl32(uint32_t x, int8_t r)
{
return (x << r) | (x >> (32 - r));
}