Permalink
Browse files

Style cleanup

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
  • Loading branch information...
1 parent e326399 commit 1ba04d9343d58d0cece62daa21ed30844aed2eb2 @yanhan committed Jun 15, 2011
Showing with 57 additions and 69 deletions.
  1. +14 −14 conf.h
  2. +0 −12 download.c
  3. +8 −8 environment.h
  4. +4 −3 hash.c
  5. +7 −7 hashdb.c
  6. +0 −1 hashdb.h
  7. +11 −11 package.c
  8. +13 −13 util.h
View
@@ -13,28 +13,28 @@ struct config_t {
unsigned short maxthreads;
unsigned short color;
- unsigned help: 1;
- unsigned version: 1;
+ unsigned help : 1;
+ unsigned version : 1;
/* Query options */
- unsigned op_q_info: 1;
- unsigned op_q_search: 1;
+ unsigned op_q_info : 1;
+ unsigned op_q_search : 1;
/* Sync options */
- unsigned op_s_info: 1;
- unsigned op_s_search: 1;
- unsigned op_s_upgrade: 1;
- unsigned op_s_check: 1;
+ unsigned op_s_info : 1;
+ unsigned op_s_search : 1;
+ unsigned op_s_upgrade : 1;
+ unsigned op_s_check : 1;
/* -G options */
- unsigned op_g_resolve: 1;
+ unsigned op_g_resolve : 1;
/* Misc */
- unsigned sort_votes: 1;
- unsigned verbose: 1;
- unsigned opt_maxthreads: 1;
- unsigned color_set: 1;
- unsigned nocolor_set: 1;
+ unsigned sort_votes : 1;
+ unsigned verbose : 1;
+ unsigned opt_maxthreads : 1;
+ unsigned color_set : 1;
+ unsigned nocolor_set : 1;
};
struct config_t *config_init(void);
View
@@ -16,9 +16,6 @@
/* For threaded downloads, points to targets */
alpm_list_t *pw_jobq = NULL;
-/* Assumption: curl options have been set except for url and writedata
- * returns -1 on failure, 0 on success.
- */
int download_single_file(CURL *curl, const char *url, FILE *fp)
{
int ret = 0;
@@ -52,12 +49,6 @@ int download_single_file(CURL *curl, const char *url, FILE *fp)
return ret;
}
-/* Downloads a single tarball from AUR.
- * Assumption: We're already in destination dir.
- *
- * returns 0 on success, -1 on failure.
- * Failed package is added to failed_packages list if it's not NULL.
- */
int download_single_package(CURL *curl, const char *pkgname,
alpm_list_t **failed_packages, int verbose)
{
@@ -101,9 +92,6 @@ int download_single_package(CURL *curl, const char *pkgname,
return ret;
}
-/* Downloads and extracts a single package.
- * returns 0 on success, -1 on failure.
- */
int dl_extract_single_package(CURL *curl, const char *pkgname,
alpm_list_t **failed_packages, int verbose)
{
View
@@ -6,15 +6,15 @@
#include "conf.h"
#include "powaur.h"
-#define AUR_URL "http://aur.archlinux.org"
-#define AUR_PKG_URL "http://aur.archlinux.org/packages.php?ID=%s"
-#define AUR_PKGTAR_URL "http://aur.archlinux.org/packages/%s/%s.tar.gz"
+#define AUR_URL "http://aur.archlinux.org"
+#define AUR_PKG_URL "http://aur.archlinux.org/packages.php?ID=%s"
+#define AUR_PKGTAR_URL "http://aur.archlinux.org/packages/%s/%s.tar.gz"
#define AUR_PKGBUILD_URL "http://aur.archlinux.org/packages/%s/PKGBUILD"
-#define AUR_RPC_URL "http://aur.archlinux.org/rpc.php?type=%s&arg=%s"
+#define AUR_RPC_URL "http://aur.archlinux.org/rpc.php?type=%s&arg=%s"
-#define AUR_RPC_TYPE_INFO "info"
+#define AUR_RPC_TYPE_INFO "info"
#define AUR_RPC_TYPE_MSEARCH "msearch"
-#define AUR_RPC_TYPE_SEARCH "search"
+#define AUR_RPC_TYPE_SEARCH "search"
/* powaur defaults */
#define PW_DEF_DIR "/tmp/powaur"
@@ -23,8 +23,8 @@
#define PW_DEF_MAXTHREADS 10
/* Pacman defaults */
-#define PACMAN_DEF_ROOTDIR "/"
-#define PACMAN_DEF_DBPATH "/var/lib/pacman/"
+#define PACMAN_DEF_ROOTDIR "/"
+#define PACMAN_DEF_DBPATH "/var/lib/pacman/"
#define PACMAN_DEF_CACHEDIR "/var/cache/pacman/pkg/"
/* Strings */
View
@@ -7,8 +7,8 @@
/* Adapted from pacman */
static const unsigned int prime_list[] =
{
- 109, 227, 467, 953, 2029, 4349, 4703,
- 10273, 22447, 45481, 92203, 202409, 410857,
+ 109, 227, 467, 953, 2029, 4349, 4703,
+ 10273, 22447, 45481, 92203, 202409, 410857,
834181, 902483, 976369, 20000003
};
@@ -495,7 +495,8 @@ static void hashbst_tree_node_free(struct hashbst_tree_node *node)
}
/* Recursion */
-static void *hashbst_tree_node_search(struct hashbst_tree_node *node, void *search, hbst_search_fn fn)
+static void *hashbst_tree_node_search(struct hashbst_tree_node *node, void *search,
+ hbst_search_fn fn)
{
if (!node) {
return NULL;
View
@@ -14,15 +14,15 @@ struct pw_hashdb *hashdb_new(void)
/* Local, sync, AUR db hash tables of struct pkgpair */
hashdb->local = hash_new(HASH_TABLE, pkgpair_sdbm, pkgpair_cmp);
- hashdb->sync = hash_new(HASH_TABLE, pkgpair_sdbm, pkgpair_cmp);
- hashdb->aur = hash_new(HASH_TABLE, pkgpair_sdbm, pkgpair_cmp);
+ hashdb->sync = hash_new(HASH_TABLE, pkgpair_sdbm, pkgpair_cmp);
+ hashdb->aur = hash_new(HASH_TABLE, pkgpair_sdbm, pkgpair_cmp);
hashdb->aur_downloaded = hash_new(HASH_TABLE, (pw_hash_fn) sdbm, (pw_hashcmp_fn) strcmp);
- hashdb->aur_outdated = hash_new(HASH_TABLE, (pw_hash_fn) sdbm, (pw_hashcmp_fn) strcmp);
+ hashdb->aur_outdated = hash_new(HASH_TABLE, (pw_hash_fn) sdbm, (pw_hashcmp_fn) strcmp);
/* Local and sync provides */
hashdb->local_provides = hashbst_new((pw_hash_fn) sdbm, (pw_hashcmp_fn) strcmp);
- hashdb->sync_provides = hashbst_new((pw_hash_fn) sdbm, (pw_hashcmp_fn) strcmp);
+ hashdb->sync_provides = hashbst_new((pw_hash_fn) sdbm, (pw_hashcmp_fn) strcmp);
/* Cache provided->providing key-value mapping */
hashdb->provides_cache = hashmap_new((pw_hash_fn) sdbm, (pw_hashcmp_fn) strcmp);
@@ -33,9 +33,9 @@ struct pw_hashdb *hashdb_new(void)
/* Initialize pkgfrom_t */
hashdb->pkg_from_unknown = PKG_FROM_UNKNOWN;
- hashdb->pkg_from_local = PKG_FROM_LOCAL;
- hashdb->pkg_from_sync = PKG_FROM_SYNC;
- hashdb->pkg_from_aur = PKG_FROM_AUR;
+ hashdb->pkg_from_local = PKG_FROM_LOCAL;
+ hashdb->pkg_from_sync = PKG_FROM_SYNC;
+ hashdb->pkg_from_aur = PKG_FROM_AUR;
return hashdb;
}
View
@@ -19,7 +19,6 @@ struct pw_hashdb {
struct hash_table *aur_outdated;
alpm_list_t *immediate_deps;
- /* Provides */
struct hashbst *local_provides;
struct hashbst *sync_provides;
View
@@ -144,17 +144,17 @@ static void parse_bash_array(alpm_list_t **list, FILE *fp,
}
}
-#define PARSE_BASH_ARRAY_PREAMBLE(myline) \
- while (1) {\
- myline = strchr(myline, '(');\
- if (myline) {\
- ++myline;\
- break;\
- }\
- myline = fgets(buf, PATH_MAX, fp);\
- if (feof (fp)) break;\
- myline = strtrim(myline);\
- }\
+#define PARSE_BASH_ARRAY_PREAMBLE(myline) \
+ while (1) { \
+ myline = strchr(myline, '('); \
+ if (myline) { \
+ ++myline; \
+ break; \
+ } \
+ myline = fgets(buf, PATH_MAX, fp); \
+ if (feof (fp)) break; \
+ myline = strtrim(myline); \
+ } \
/* Obtain deps, optional deps, conflicts, replaces from fp */
void parse_pkgbuild(struct aurpkg_t *pkg, FILE *fp)
View
@@ -78,25 +78,25 @@ unsigned long sdbm(const char *str);
#define MINI_BUFSZ 60
-#define ASSERT(somecond, someact) do {\
- if (!(somecond)) {\
- someact;\
- }\
+#define ASSERT(somecond, someact) do { \
+ if (!(somecond)) { \
+ someact; \
+ } \
} while (0)
-#define PW_SETERRNO(errnum) do {\
- pwerrno = errnum;\
- pw_fprintf(PW_LOG_ERROR, stderr, "%s: %s\n", __func__, pw_strerrorlast());\
+#define PW_SETERRNO(errnum) do { \
+ pwerrno = errnum; \
+ pw_fprintf(PW_LOG_ERROR, stderr, "%s: %s\n", __func__, pw_strerrorlast()); \
} while (0)
-#define CLEAR_ERRNO() do {\
- pwerrno = PW_ERR_OK;\
+#define CLEAR_ERRNO() do { \
+ pwerrno = PW_ERR_OK; \
} while (0)
-#define RET_ERR(errnum, retval) do {\
- pwerrno = errnum;\
- pw_printf(PW_LOG_ERROR, "%s: %s\n", __func__, pw_strerror(errnum));\
- return retval;\
+#define RET_ERR(errnum, retval) do { \
+ pwerrno = errnum; \
+ pw_printf(PW_LOG_ERROR, "%s: %s\n", __func__, pw_strerror(errnum)); \
+ return retval; \
} while (0)
#endif

0 comments on commit 1ba04d9

Please sign in to comment.