]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Clean up the global namespace
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Fri, 17 Apr 2020 17:30:10 +0000 (12:30 -0500)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Fri, 17 Apr 2020 17:30:10 +0000 (12:30 -0500)
These minipatches are courtesy of cgcc.

13 files changed:
src/cert_stack.c
src/config/uint32.c
src/data_structure/array_list.h
src/http/http.c
src/json_handler.c
src/main.c
src/object/certificate.c
src/output_printer.c
src/rpp.c
src/rtr/pdu.c
src/slurm/db_slurm.c
src/slurm/slurm_parser.c
src/sorted_array.c

index 5cedf0ad2b806afda1e77d25164a351c85b0d3d9..724dc09e61a997ec9122cb6d76d64600f8d5ad2e 100644 (file)
@@ -33,14 +33,14 @@ struct serial_number {
        char *file; /* File where this serial number was found. */
 };
 
-ARRAY_LIST(serial_numbers, struct serial_number)
+STATIC_ARRAY_LIST(serial_numbers, struct serial_number)
 
 struct subject_name {
        struct rfc5280_name *name;
        char *file; /* File where this subject name was found. */
 };
 
-ARRAY_LIST(subjects, struct subject_name)
+STATIC_ARRAY_LIST(subjects, struct subject_name)
 
 /**
  * Cached certificate data.
index 842516a69a9076db5f9082f4e19c0cd2b72bbf51..a64699d463830507ca11576ee81bce4e0c2465df 100644 (file)
@@ -1,4 +1,4 @@
-#include "config/uint.h"
+#include "config/uint32.h"
 
 #include <getopt.h>
 #include <errno.h>
index b20cb9d885e676586e0dcbd5ff13917ec27a73ba..716dbe62a3cd544d47ac28901def60092958370f 100644 (file)
        DEFINE_ARRAY_LIST_STRUCT(name, elem_type);                      \
        DEFINE_ARRAY_LIST_FUNCTIONS(name, elem_type, )
 
+#define STATIC_ARRAY_LIST(name, elem_type)                             \
+       DEFINE_ARRAY_LIST_STRUCT(name, elem_type);                      \
+       DEFINE_ARRAY_LIST_FUNCTIONS(name, elem_type, static)
+
 #define ARRAYLIST_FOREACH(list, node, index) for (                     \
        (index) = 0, (node) = (list)->array;                            \
        (index) < (list)->len;                                          \
index 6f42cbf33f61672e2532f5114101a80982a4dd6c..ee179e53590d52c06417675eb76f5d035a4a741b 100644 (file)
@@ -164,7 +164,7 @@ __http_download_file(struct rpki_uri *uri, http_write_cb cb,
 
        *cond_met = 1;
        if (config_get_work_offline()) {
-               response_code = 0; /* Not 200 code, but also not an error */
+               *response_code = 0; /* Not 200 code, but also not an error */
                return 0;
        }
 
@@ -213,8 +213,8 @@ delete_dir:
 int
 http_download_file(struct rpki_uri *uri, http_write_cb cb)
 {
-       long response = 0;
-       long cond_met = 0;
+       long response;
+       long cond_met;
        return __http_download_file(uri, cb, &response, 0, &cond_met);
 }
 
@@ -233,8 +233,8 @@ http_download_file(struct rpki_uri *uri, http_write_cb cb)
 int
 http_download_file_with_ims(struct rpki_uri *uri, http_write_cb cb, long value)
 {
-       long response = 0;
-       long cond_met = 0;
+       long response;
+       long cond_met;
        int error;
 
        error = __http_download_file(uri, cb, &response, value, &cond_met);
index 6d7488c12d5e0a5a77e6935445ffcc0447cafbc5..15389d1f26e4955249646ba2699adcddeb68de10 100644 (file)
@@ -7,7 +7,7 @@
 #include "log.h"
 #include "config/types.h"
 
-int
+static int
 find_json(struct json_t *root, char const *full_name, json_t **result)
 {
        struct {
@@ -39,7 +39,7 @@ static int
 json_to_config(struct json_t *root)
 {
        struct option_field const *opt;
-       struct json_t *child;
+       struct json_t *child = NULL;
        int error;
 
        FOREACH_OPTION(get_option_metadatas(), opt, AVAILABILITY_JSON) {
index 96d1f4df648c5f671ac05d7194c0c9d0357839b4..87da64f4cd595112a8020678def8a6dc12b81df8 100644 (file)
@@ -32,7 +32,7 @@ just_quit:
        return error;
 }
 
-int
+static int
 __main(int argc, char **argv)
 {
        int error;
index a011ec4021b9819f3f7c580492d2a135d1312ad2..c7d5c20bec16fcf0c4b4ab4a584872b79dbad184 100644 (file)
@@ -962,7 +962,7 @@ handle_asn_extension(X509_EXTENSION *ext, struct resources *resources,
        return error;
 }
 
-int
+static int
 __certificate_get_resources(X509 *cert, struct resources *resources,
     int addr_nid, int asn_nid, int bad_addr_nid, int bad_asn_nid,
     char const *policy_rfc, char const *bad_ext_rfc, bool allow_asn_inherit)
index 7cfa54f7d674ab98707982db92821a12522964e4..1f13fb653011e0d7b4a4e9901602ba5961625814 100644 (file)
@@ -8,7 +8,7 @@
 #include "crypto/base64.h"
 #include "rtr/db/vrp.h"
 
-char addr_buf[INET6_ADDRSTRLEN];
+static char addr_buf[INET6_ADDRSTRLEN];
 
 static int
 load_output_file(char const *output, FILE **result, bool *fopen)
index e7e9194384d8b56c881f48d039cbd986dedf3d39..c73c067cfb5cf1549ff1d53d143f11458ffd9032 100644 (file)
--- a/src/rpp.c
+++ b/src/rpp.c
@@ -11,7 +11,7 @@
 #include "object/ghostbusters.h"
 #include "object/roa.h"
 
-ARRAY_LIST(uris, struct rpki_uri *)
+STATIC_ARRAY_LIST(uris, struct rpki_uri *)
 
 /** A Repository Publication Point (RFC 6481), as described by some manifest. */
 struct rpp {
@@ -76,7 +76,7 @@ rpp_refget(struct rpp *pp)
        pp->references++;
 }
 
-void
+static void
 __uri_refput(struct rpki_uri **uri)
 {
        uri_refput(*uri);
index 327e1c8c5cecbfeaec62db0d71444079b45ad7a0..f238c63981bebfc8e1afbb54477c40c124c16187 100644 (file)
@@ -355,7 +355,7 @@ DEFINE_METADATA(cache_reset, free);
 DEFINE_METADATA(router_key, free);
 DEFINE_METADATA(error_report, error_report_destroy);
 
-struct pdu_metadata const *const pdu_metadatas[] = {
+static struct pdu_metadata const *const pdu_metadatas[] = {
        /* 0 */  &serial_notify_meta,
        /* 1 */  &serial_query_meta,
        /* 2 */  &reset_query_meta,
index bff42a93cf167a11a5c9a51218ee02fd5587009c..2cb6a7e4feaf31a0b375399b5e410589a4801314 100644 (file)
@@ -19,10 +19,10 @@ struct slurm_bgpsec_wrap {
        unsigned int references;
 };
 
-ARRAY_LIST(al_filter_prefix, struct slurm_prefix_wrap)
-ARRAY_LIST(al_assertion_prefix, struct slurm_prefix_wrap)
-ARRAY_LIST(al_filter_bgpsec, struct slurm_bgpsec_wrap)
-ARRAY_LIST(al_assertion_bgpsec, struct slurm_bgpsec_wrap)
+STATIC_ARRAY_LIST(al_filter_prefix, struct slurm_prefix_wrap)
+STATIC_ARRAY_LIST(al_assertion_prefix, struct slurm_prefix_wrap)
+STATIC_ARRAY_LIST(al_filter_bgpsec, struct slurm_bgpsec_wrap)
+STATIC_ARRAY_LIST(al_assertion_bgpsec, struct slurm_bgpsec_wrap)
 
 struct slurm_lists {
        struct al_filter_prefix filter_pfx_al;
@@ -39,7 +39,7 @@ struct db_slurm {
        struct slurm_csum_list csum_list;
 };
 
-char addr_buf[INET6_ADDRSTRLEN];
+static char addr_buf[INET6_ADDRSTRLEN];
 
 static void
 slurm_bgpsec_wrap_refget(struct slurm_bgpsec_wrap *elem)
index d06514a976dcca6c929e49c9acac508962d64de6..cbfb2467400aac210a78b1b9cf5066e6a77197d2 100644 (file)
@@ -207,7 +207,7 @@ set_max_prefix_length(json_t *object, bool is_assertion, uint8_t addr_fam,
 
 }
 
-int
+static int
 validate_base64url_encoded(const char *encoded)
 {
        /*
index 73ed0dc05152a8d57152e93a46cc8bbd038c7fb5..08b33b6138c36de1ebf63676710d20d9bcc52035 100644 (file)
@@ -58,13 +58,6 @@ sarray_put(struct sorted_array *sarray)
        }
 }
 
-void
-sarray_destroy(struct sorted_array *sarray)
-{
-       free(sarray->array);
-       free(sarray);
-}
-
 /* Does not check boundaries. */
 static void *
 get_nth_element(struct sorted_array *sarray, unsigned int index)