]> git.ipfire.org Git - pakfire.git/commitdiff
scriptlets: Constify list of scriptlet types
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 7 Feb 2021 17:49:54 +0000 (17:49 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 7 Feb 2021 17:49:54 +0000 (17:49 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/scriptlet.h
src/libpakfire/scriptlet.c

index e572f097a26cee9d559cc4c9731542a9efde60ca..4e2f8a7eacf7a0c947c2073a745fc6be21de5399 100644 (file)
@@ -51,7 +51,7 @@ struct pakfire_scriptlet_type {
        const char* handle;
 };
 
-struct pakfire_scriptlet_type PAKFIRE_SCRIPTLET_TYPES[NUM_PAKFIRE_SCRIPTLET_TYPES + 1];
+const struct pakfire_scriptlet_type PAKFIRE_SCRIPTLET_TYPES[NUM_PAKFIRE_SCRIPTLET_TYPES + 1];
 
 struct pakfire_scriptlet {
        pakfire_scriptlet_type type;
index 1f0166c7bd1a7bc55a25fbf02e27a132fa0dae9c..2fd43b884fccd2e55bf89f669db1f052504ac7e4 100644 (file)
@@ -25,7 +25,7 @@
 #include <pakfire/scriptlet.h>
 #include <pakfire/types.h>
 
-struct pakfire_scriptlet_type PAKFIRE_SCRIPTLET_TYPES[NUM_PAKFIRE_SCRIPTLET_TYPES + 1] = {
+const struct pakfire_scriptlet_type PAKFIRE_SCRIPTLET_TYPES[NUM_PAKFIRE_SCRIPTLET_TYPES + 1] = {
        { PAKFIRE_SCRIPTLET_PREIN,       "scriptlets/prein",       "prein" },
        { PAKFIRE_SCRIPTLET_PREUN,       "scriptlets/preun",       "preun" },
        { PAKFIRE_SCRIPTLET_PREUP,       "scriptlets/preup",       "preup" },
@@ -59,7 +59,7 @@ void pakfire_scriptlet_free(struct pakfire_scriptlet* scriptlet) {
 }
 
 pakfire_scriptlet_type pakfire_scriptlet_type_from_filename(const char* filename) {
-       struct pakfire_scriptlet_type* t = PAKFIRE_SCRIPTLET_TYPES;
+       const struct pakfire_scriptlet_type* t = PAKFIRE_SCRIPTLET_TYPES;
 
        while (t->type) {
                if (strcmp(t->filename, filename) == 0)
@@ -72,7 +72,7 @@ pakfire_scriptlet_type pakfire_scriptlet_type_from_filename(const char* filename
 }
 
 const char* pakfire_scriptlet_handle_from_type(pakfire_scriptlet_type type) {
-       struct pakfire_scriptlet_type* t = PAKFIRE_SCRIPTLET_TYPES;
+       const struct pakfire_scriptlet_type* t = PAKFIRE_SCRIPTLET_TYPES;
 
        while (t->type) {
                if (t->type == type)