diff options
author | Carsten Schoenert <c.schoenert@gmail.com> | 2013-11-29 14:19:15 (EST) |
---|---|---|
committer | Paul Barker <paul@paulbarker.me.uk> | 2013-12-17 16:00:36 (EST) |
commit | 6b8be706c08f547d17949f2f72783375bbb8b14c (patch) | |
tree | 7e177d6a719577c6823640db457f833304479cb3 | |
parent | fed9b245150a7faa630f7615302c472b7c68ff3e (diff) |
libopkg: cleanup inside the public header files
No functional changes!
Just a cleanup like whitespaces, blank lines, tabs and reformating lines
longer 76 characters.
Also adding the missed comments at the closing bracket from the #ifndef
HEADER_FOO_H ... #endif loop. This helps to identify the associated
preprocessor elements like theay already exits in some files.
Signed-off-by: Carsten Schoenert <c.schoenert@gmail.com>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
36 files changed, 96 insertions, 107 deletions
diff --git a/libopkg/cksum_list.h b/libopkg/cksum_list.h index cfa8ec0..56a1191 100644 --- a/libopkg/cksum_list.h +++ b/libopkg/cksum_list.h @@ -51,4 +51,4 @@ const cksum_t *cksum_list_find(cksum_list_t *list, const char *name); } #endif -#endif +#endif /* CKSUM_LIST_H */ diff --git a/libopkg/conffile.h b/libopkg/conffile.h index 9747be6..3a9d5ee 100644 --- a/libopkg/conffile.h +++ b/libopkg/conffile.h @@ -33,4 +33,4 @@ int conffile_has_been_modified(conffile_t *conffile); } #endif -#endif +#endif /* CONFFILE_H */ diff --git a/libopkg/conffile_list.h b/libopkg/conffile_list.h index 5d4293a..715a59b 100644 --- a/libopkg/conffile_list.h +++ b/libopkg/conffile_list.h @@ -41,4 +41,4 @@ conffile_list_elt_t *conffile_list_pop(conffile_list_t *list); } #endif -#endif +#endif /* CONFFILE_LIST_H */ diff --git a/libopkg/file_util.h b/libopkg/file_util.h index 95f7fe7..d4ae05f 100644 --- a/libopkg/file_util.h +++ b/libopkg/file_util.h @@ -36,4 +36,4 @@ int rm_r(const char *path); } #endif -#endif +#endif /* FILE_UTIL_H */ diff --git a/libopkg/list.h b/libopkg/list.h index 250eebb..f164129 100644 --- a/libopkg/list.h +++ b/libopkg/list.h @@ -73,7 +73,6 @@ static inline void list_add_tail(struct list_head *newitem, struct list_head *he __list_add(newitem, head->prev, head); } - /* * Delete a list entry by making the prev/next entries * point to each other. @@ -191,8 +190,6 @@ static inline void list_splice_init(struct list_head *list, } } - - #define _offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ @@ -309,4 +306,4 @@ static inline void list_splice_init(struct list_head *list, } #endif -#endif +#endif /* _LINUX_LIST_H */ diff --git a/libopkg/md5.h b/libopkg/md5.h index e89c62e..3e6e652 100644 --- a/libopkg/md5.h +++ b/libopkg/md5.h @@ -19,7 +19,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _MD5_H -#define _MD5_H 1 +#define _MD5_H #include <stdio.h> #include <stdint.h> @@ -100,13 +100,11 @@ extern void __md5_process_bytes (const void *buffer, size_t len, ASCII representation of the message digest. */ extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW; - /* Put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; - /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ @@ -123,4 +121,4 @@ extern void *__md5_buffer (const char *buffer, size_t len, } #endif -#endif /* md5.h */ +#endif /* MD5_H */ diff --git a/libopkg/nv_pair.h b/libopkg/nv_pair.h index 98c1706..72a9b23 100644 --- a/libopkg/nv_pair.h +++ b/libopkg/nv_pair.h @@ -36,4 +36,4 @@ void nv_pair_deinit(nv_pair_t *nv_pair); } #endif -#endif +#endif /* NV_PAIR_H */ diff --git a/libopkg/nv_pair_list.h b/libopkg/nv_pair_list.h index cf8893c..5b427d9 100644 --- a/libopkg/nv_pair_list.h +++ b/libopkg/nv_pair_list.h @@ -52,4 +52,4 @@ nv_pair_list_elt_t *nv_pair_list_last(nv_pair_list_t *list); } #endif -#endif +#endif /* NV_PAIR_LIST_H */ diff --git a/libopkg/opkg.h b/libopkg/opkg.h index 4c8f902..765b063 100644 --- a/libopkg/opkg.h +++ b/libopkg/opkg.h @@ -32,16 +32,16 @@ typedef void (*opkg_package_callback_t) (pkg_t *pkg, void *user_data); enum _opkg_action_t { - OPKG_INSTALL, - OPKG_REMOVE, - OPKG_DOWNLOAD + OPKG_INSTALL, + OPKG_REMOVE, + OPKG_DOWNLOAD }; struct _opkg_progress_data_t { - int percentage; - int action; - pkg_t *pkg; + int percentage; + int action; + pkg_t *pkg; }; int opkg_new (void); diff --git a/libopkg/opkg_cmd.h b/libopkg/opkg_cmd.h index 8fa70fc..bc139d8 100644 --- a/libopkg/opkg_cmd.h +++ b/libopkg/opkg_cmd.h @@ -42,4 +42,4 @@ extern int opkg_state_changed; } #endif -#endif +#endif /* OPKG_CMD_H */ diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h index 1fc8515..38fa375 100644 --- a/libopkg/opkg_conf.h +++ b/libopkg/opkg_conf.h @@ -152,4 +152,4 @@ char *root_filename_alloc(char *filename); } #endif -#endif +#endif /* OPKG_CONF_H */ diff --git a/libopkg/opkg_configure.h b/libopkg/opkg_configure.h index 1889a04..bed5011 100644 --- a/libopkg/opkg_configure.h +++ b/libopkg/opkg_configure.h @@ -30,4 +30,4 @@ int opkg_configure(pkg_t *pkg); } #endif -#endif +#endif /* OPKG_CONFIGURE_H */ diff --git a/libopkg/opkg_download.h b/libopkg/opkg_download.h index ff5f7da..7f28f3a 100644 --- a/libopkg/opkg_download.h +++ b/libopkg/opkg_download.h @@ -27,7 +27,6 @@ extern "C" { typedef void (*opkg_download_progress_callback)(int percent, char *url); typedef int (*curl_progress_func)(void *data, double t, double d, double ultotal, double ulnow); - int opkg_download(const char *src, const char *dest_file_name, curl_progress_func cb, void *data, const short hide_error); int opkg_download_pkg(pkg_t *pkg, const char *dir); /* @@ -48,4 +47,4 @@ void opkg_curl_cleanup(void); #ifdef __cplusplus } #endif -#endif +#endif /* OPKG_DOWNLOAD_H */ diff --git a/libopkg/opkg_install.h b/libopkg/opkg_install.h index 48acc55..29871dd 100644 --- a/libopkg/opkg_install.h +++ b/libopkg/opkg_install.h @@ -32,4 +32,4 @@ int opkg_install_pkg(pkg_t *pkg, int from_upgrading); } #endif -#endif +#endif /* OPKG_INSTALL_H */ diff --git a/libopkg/opkg_remove.h b/libopkg/opkg_remove.h index 2cb605f..36275fa 100644 --- a/libopkg/opkg_remove.h +++ b/libopkg/opkg_remove.h @@ -34,4 +34,4 @@ void remove_maintainer_scripts(pkg_t *pkg); } #endif -#endif +#endif /* OPKG_REMOVE_H */ diff --git a/libopkg/opkg_upgrade.h b/libopkg/opkg_upgrade.h index 5bed335..1adea72 100644 --- a/libopkg/opkg_upgrade.h +++ b/libopkg/opkg_upgrade.h @@ -27,4 +27,4 @@ struct active_list * prepare_upgrade_list (void); } #endif -#endif +#endif /* OPKG_UPGRADE_H */ diff --git a/libopkg/opkg_utils.h b/libopkg/opkg_utils.h index 33074b9..5d1b47e 100644 --- a/libopkg/opkg_utils.h +++ b/libopkg/opkg_utils.h @@ -30,4 +30,4 @@ int line_is_blank(const char *line); } #endif -#endif +#endif /* OPKG_UTILS_H */ diff --git a/libopkg/parse_util.h b/libopkg/parse_util.h index 0a4fbda..a2498c5 100644 --- a/libopkg/parse_util.h +++ b/libopkg/parse_util.h @@ -36,4 +36,4 @@ int parse_from_stream_nomalloc(parse_line_t parse_line, void *item, FILE *fp, ui } #endif -#endif +#endif /* PARSE_UTIL_H */ diff --git a/libopkg/pkg.h b/libopkg/pkg.h index 744dd9f..1e3dd3f 100644 --- a/libopkg/pkg.h +++ b/libopkg/pkg.h @@ -34,7 +34,6 @@ extern "C" { struct opkg_conf; - #define ARRAY_SIZE(array) sizeof(array) / sizeof((array)[0]) /* I think "Size" is currently the shortest field name */ @@ -65,6 +64,7 @@ enum pkg_state_flag SF_LAST_STATE_FLAG }; typedef enum pkg_state_flag pkg_state_flag_t; + #define SF_NONVOLATILE_FLAGS (SF_HOLD|SF_NOPRUNE|SF_PREFER|SF_OBSOLETE|SF_USER) enum pkg_state_status @@ -164,8 +164,8 @@ struct pkg char *tmp_unpack_dir; char *md5sum; char *sha256sum; - unsigned long size; /* in bytes */ - unsigned long installed_size; /* in bytes */ + unsigned long size; /* in bytes */ + unsigned long installed_size; /* in bytes */ char *priority; char *source; conffile_list_t conffiles; @@ -173,17 +173,19 @@ struct pkg /* As pointer for lazy evaluation */ str_list_t *installed_files; /* XXX: CLEANUP: I'd like to perhaps come up with a better - mechanism to avoid the problem here, (which is that the - installed_files list was being freed from an inner loop while - still being used within an outer loop. */ + mechanism to avoid the problem here, (which is that the + installed_files list was being freed from an inner loop while + still being used within an outer loop. */ int installed_files_ref_cnt; int essential; int arch_priority; -/* Adding this flag, to "force" opkg to choose a "provided_by_hand" package, if there are multiple choice */ + /* Adding this flag, to "force" opkg to choose a "provided_by_hand" + * package, if there are multiple choice */ int provided_by_hand; /* this flag specifies whether the package was installed to satisfy another - * package's dependancies */ + * package's dependancies + */ int auto_installed; }; @@ -233,4 +235,4 @@ int pkg_write_changed_filelists(void); } #endif -#endif +#endif /* PKG_H */ diff --git a/libopkg/pkg_depends.h b/libopkg/pkg_depends.h index 25461da..eebb7b8 100644 --- a/libopkg/pkg_depends.h +++ b/libopkg/pkg_depends.h @@ -98,4 +98,4 @@ int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg); } #endif -#endif +#endif /* PKG_DEPENDS_H */ diff --git a/libopkg/pkg_dest.h b/libopkg/pkg_dest.h index 5beb601..2078eb7 100644 --- a/libopkg/pkg_dest.h +++ b/libopkg/pkg_dest.h @@ -43,5 +43,4 @@ void pkg_dest_deinit(pkg_dest_t *dest); } #endif -#endif - +#endif /* PKG_DEST_H */ diff --git a/libopkg/pkg_dest_list.h b/libopkg/pkg_dest_list.h index 421a827..43bd11f 100644 --- a/libopkg/pkg_dest_list.h +++ b/libopkg/pkg_dest_list.h @@ -43,5 +43,4 @@ pkg_dest_list_elt_t *pkg_dest_list_pop(pkg_dest_list_t *list); } #endif -#endif - +#endif /* PKG_DEST_LIST_H */ diff --git a/libopkg/pkg_extract.h b/libopkg/pkg_extract.h index 82ef8b1..46bd4c7 100644 --- a/libopkg/pkg_extract.h +++ b/libopkg/pkg_extract.h @@ -36,4 +36,4 @@ int pkg_extract_data_file_names_to_stream(pkg_t *pkg, FILE *file); } #endif -#endif +#endif /* PKG_EXTRACT_H */ diff --git a/libopkg/pkg_hash.h b/libopkg/pkg_hash.h index 8901a9b..ed010ef 100644 --- a/libopkg/pkg_hash.h +++ b/libopkg/pkg_hash.h @@ -27,7 +27,6 @@ extern "C" { #include "pkg_dest.h" #include "hash_table.h" - void pkg_hash_init(void); void pkg_hash_deinit(void); @@ -60,5 +59,4 @@ void file_hash_set_file_owner(const char *file_name, pkg_t *pkg); } #endif -#endif - +#endif /* PKG_HASH_H */ diff --git a/libopkg/pkg_parse.h b/libopkg/pkg_parse.h index 358afa9..d8abf75 100644 --- a/libopkg/pkg_parse.h +++ b/libopkg/pkg_parse.h @@ -29,37 +29,37 @@ int pkg_parse_from_stream(pkg_t *pkg, FILE *fp, uint mask); int pkg_parse_line(void *ptr, const char *line, uint mask); /* 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_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) +#define PFM_ALL (~(uint)0) #ifdef __cplusplus } #endif -#endif +#endif /* PKG_PARSE_H */ diff --git a/libopkg/pkg_src.h b/libopkg/pkg_src.h index 30192bb..8c2f40c 100644 --- a/libopkg/pkg_src.h +++ b/libopkg/pkg_src.h @@ -26,10 +26,10 @@ extern "C" { typedef struct { - char *name; - char *value; - char *extra_data; - int gzip; + char *name; + char *value; + char *extra_data; + int gzip; } pkg_src_t; int pkg_src_init(pkg_src_t *src, const char *name, const char *base_url, const char *extra_data, int gzip); @@ -39,4 +39,4 @@ void pkg_src_deinit(pkg_src_t *src); } #endif -#endif +#endif /* PKG_SRC_H */ diff --git a/libopkg/pkg_src_list.h b/libopkg/pkg_src_list.h index 14d6445..1338c95 100644 --- a/libopkg/pkg_src_list.h +++ b/libopkg/pkg_src_list.h @@ -40,7 +40,11 @@ void pkg_src_list_elt_deinit(pkg_src_list_elt_t *elt); void pkg_src_list_init(pkg_src_list_t *list); void pkg_src_list_deinit(pkg_src_list_t *list); -pkg_src_t *pkg_src_list_append(pkg_src_list_t *list, const char *name, const char *root_dir, const char *extra_data, int gzip); +pkg_src_t *pkg_src_list_append(pkg_src_list_t *list, + const char *name, + const char *root_dir, + const char *extra_data, + int gzip); void pkg_src_list_push(pkg_src_list_t *list, pkg_src_t *data); pkg_src_list_elt_t *pkg_src_list_pop(pkg_src_list_t *list); @@ -48,5 +52,4 @@ pkg_src_list_elt_t *pkg_src_list_pop(pkg_src_list_t *list); } #endif -#endif - +#endif /* PKG_SRC_LIST_H */ diff --git a/libopkg/pkg_vec.h b/libopkg/pkg_vec.h index 74e3c97..ab5304c 100644 --- a/libopkg/pkg_vec.h +++ b/libopkg/pkg_vec.h @@ -41,7 +41,6 @@ struct abstract_pkg_vec unsigned int len; }; - pkg_vec_t * pkg_vec_alloc(void); void pkg_vec_free(pkg_vec_t *vec); @@ -68,5 +67,4 @@ int pkg_compare_names(const void *p1, const void *p2); } #endif -#endif - +#endif /* PKG_VEC_H */ diff --git a/libopkg/release.h b/libopkg/release.h index 99c36a5..b57b415 100644 --- a/libopkg/release.h +++ b/libopkg/release.h @@ -56,4 +56,4 @@ int release_verify_file(release_t *release, const char *filename, const char *pa } #endif -#endif +#endif /* RELEASE_H */ diff --git a/libopkg/release_parse.h b/libopkg/release_parse.h index 424b3b5..b269b24 100644 --- a/libopkg/release_parse.h +++ b/libopkg/release_parse.h @@ -26,4 +26,4 @@ int release_parse_from_stream(release_t *release, FILE *fp); } #endif -#endif +#endif /* RELEASE_PARSE_H */ diff --git a/libopkg/sha256.h b/libopkg/sha256.h index c53277d..858d319 100644 --- a/libopkg/sha256.h +++ b/libopkg/sha256.h @@ -17,7 +17,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SHA256_H -# define SHA256_H 1 +#define SHA256_H # include <stdio.h> # include <stdint.h> @@ -29,14 +29,12 @@ extern "C" { /* Structure to save state of computation between the single steps. */ struct sha256_ctx { - uint32_t state[8]; - - uint32_t total[2]; - uint32_t buflen; - uint32_t buffer[32]; + uint32_t state[8]; + uint32_t total[2]; + uint32_t buflen; + uint32_t buffer[32]; }; - /* Initialize structure containing state of computation. */ extern void sha256_init_ctx (struct sha256_ctx *ctx); extern void sha224_init_ctx (struct sha256_ctx *ctx); @@ -56,7 +54,7 @@ extern void sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx); /* Process the remaining bytes in the buffer and put result from CTX - in first 32 (28) bytes following RESBUF. The result is always in little + in first 32 (28) bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. @@ -65,8 +63,7 @@ extern void sha256_process_bytes (const void *buffer, size_t len, extern void *sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf); extern void *sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf); - -/* Put result from CTX in first 32 (28) bytes following RESBUF. The result is +/* Put result from CTX in first 32 (28) bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. @@ -75,14 +72,13 @@ extern void *sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf); extern void *sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf); extern void *sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf); - /* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The resulting message digest number will be written into the 32 (28) bytes beginning at RESBLOCK. */ extern int sha256_stream (FILE *stream, void *resblock); extern int sha224_stream (FILE *stream, void *resblock); -/* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER. The +/* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ @@ -93,4 +89,4 @@ extern void *sha224_buffer (const char *buffer, size_t len, void *resblock); } #endif -#endif +#endif /* SHA256_H */ diff --git a/libopkg/sprintf_alloc.h b/libopkg/sprintf_alloc.h index fc00403..d1afa92 100644 --- a/libopkg/sprintf_alloc.h +++ b/libopkg/sprintf_alloc.h @@ -28,4 +28,4 @@ void sprintf_alloc(char **str, const char *fmt, ...); } #endif -#endif +#endif /* SPRINTF_ALLOC_H */ diff --git a/libopkg/str_list.h b/libopkg/str_list.h index f0a714d..bcd539a 100644 --- a/libopkg/str_list.h +++ b/libopkg/str_list.h @@ -52,4 +52,4 @@ void str_list_purge(str_list_t *list); } #endif -#endif +#endif /* STR_LIST_H */ diff --git a/libopkg/void_list.h b/libopkg/void_list.h index 8cb85f2..c7c67e4 100644 --- a/libopkg/void_list.h +++ b/libopkg/void_list.h @@ -68,4 +68,4 @@ void void_list_purge(void_list_t *list); } #endif -#endif +#endif /* VOID_LIST_H */ diff --git a/libopkg/xregex.h b/libopkg/xregex.h index 9fc55a1..f1f3a4a 100644 --- a/libopkg/xregex.h +++ b/libopkg/xregex.h @@ -35,4 +35,4 @@ static inline void xregfree(regex_t *preg) } #endif -#endif +#endif /* XREGEX_H */ diff --git a/libopkg/xsystem.h b/libopkg/xsystem.h index 51678e3..81cfedb 100644 --- a/libopkg/xsystem.h +++ b/libopkg/xsystem.h @@ -36,5 +36,5 @@ int xsystem(const char *argv[]); } #endif -#endif +#endif /* XSYSTEM_H */ |