Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Fix code style issues
Browse files Browse the repository at this point in the history
Signed-off-by: Tudor Marcu <[email protected]>
  • Loading branch information
tmarcu committed May 10, 2017
1 parent 7eff793 commit 0d35288
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/analyze_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ int compute_hash(struct file *file, char *filename)
return 0;
}

hash_set_zeros(key); /* Set to 64 '0' (not '\0') characters */
hash_set_zeros(key); /* Set to 64 '0' (not '\0') characters */

if (file->is_link) {
char link[PATH_MAX];
Expand Down
4 changes: 2 additions & 2 deletions src/fullfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static GList *get_deduplicated_fullfile_list(struct manifest *manifest)
// presort by hash for easy deduplication
list = manifest->files = g_list_sort(manifest->files, file_sort_hash);

for (; list ; list = g_list_next(list)) {
for (; list; list = g_list_next(list)) {
tmp = list->data;

// find first new file
Expand All @@ -261,7 +261,7 @@ static GList *get_deduplicated_fullfile_list(struct manifest *manifest)
break;
}
}
for (; list ; list = g_list_next(list)) {
for (; list; list = g_list_next(list)) {
file = list->data;

// add any new file having a unique hash
Expand Down
1 change: 0 additions & 1 deletion src/make_packs.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <dirent.h>
#include <errno.h>
#include <getopt.h>
#include <getopt.h>
#include <glib.h>
#include <locale.h>
#include <stdio.h>
Expand Down
27 changes: 12 additions & 15 deletions src/rename.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*
*/


/* Rename detection and support.
*/

Expand Down Expand Up @@ -67,7 +66,7 @@ static char *getmagic(char *filename)
c1 = (char *)magic_file(mcookie, filename);
if (!c1) {
LOG(NULL, "Cannot find file type", "%s", filename);
c1="";
c1 = "";
}
c1 = strdup(c1);
c2 = strstr(c1, ", BuildID[");
Expand Down Expand Up @@ -197,7 +196,7 @@ static void precompute_file_data(int version, const char *component, struct file
c1 = file->filename;
c2 = file->alpha_only_filename;
if (c2) {
for(; *c1 ; c1++) {
for (; *c1; c1++) {
if (isalpha(*c1)) { /* Only copy letters */
*c2++ = *c1;
}
Expand Down Expand Up @@ -280,16 +279,15 @@ static void score_file(GList *deleted_files, struct file *file)
}

/* delete the first element of the list and return the new head */
static GList* del_first(GList *list)
static GList *del_first(GList *list)
{
/* The first list is the pointer to the list, the second is
* the pointer to what to delete */
return g_list_delete_link(list, list);
}


/* Take a list, return a new list where the filter function returns true */
static GList* new_filtered_list(GList *list, int version, int (*f)(struct file *file, int version))
static GList *new_filtered_list(GList *list, int version, int (*f)(struct file *file, int version))
{
/* make a list of new files, no peer */
GList *newlist = NULL;
Expand All @@ -310,7 +308,7 @@ static int renamed_file_p(struct file *file, int unused)
/* Return a new list of renamed files */
static GList *new_list_renamed_files(GList *infiles)
{
return new_filtered_list(infiles,0,renamed_file_p);
return new_filtered_list(infiles, 0, renamed_file_p);
}

/* Predicate that returns true if this is a new file in the stated version */
Expand All @@ -326,13 +324,13 @@ static int new_file_p(struct file *file, int version)
}

/* return a new list of the new files */
static GList* list_new_files(struct manifest *manifest)
static GList *list_new_files(struct manifest *manifest)
{
GList *list = new_filtered_list(manifest->files, manifest->version, new_file_p);
/* call precompute_file_data for each file on list, return the list */
GList *ret = list;
for (list = g_list_first(list); list ; list = g_list_next(list)) {
struct file *file=list->data;
for (list = g_list_first(list); list; list = g_list_next(list)) {
struct file *file = list->data;
precompute_file_data(manifest->version, manifest->component, file, true);
}
return ret;
Expand All @@ -349,12 +347,12 @@ static int deleted_p(struct file *file, int version)
return 1;
}

static GList* list_deleted_files(struct manifest *manifest)
static GList *list_deleted_files(struct manifest *manifest)
{
GList *list = new_filtered_list(manifest->files, manifest->version, deleted_p);
GList *ret = list;
/* call precompute_file_data for each peer of file on list */
for (list = g_list_first(list); list ; list = g_list_next(list)) {
for (list = g_list_first(list); list; list = g_list_next(list)) {
struct file *file = list->data;
struct file *peer = file->peer;
/* Need to get things from the /full/ as we do not know
Expand Down Expand Up @@ -408,7 +406,7 @@ void rename_detection(struct manifest *manifest)
*/
new_files = g_list_sort(new_files, file_sort_score);

for (; new_files ; new_files = del_first(new_files)) {
for (; new_files; new_files = del_first(new_files)) {
file = new_files->data;
if (file->rename_peer == NULL) {
continue;
Expand Down Expand Up @@ -438,7 +436,7 @@ void rename_detection(struct manifest *manifest)
file->is_rename = 1;
file->rename_peer->is_rename = 1;
if (!deleted_files) {
break; /* No more deleted files to rename */
break; /* No more deleted files to rename */
}

} /* lather, rinse, repeat until all files have a target */
Expand All @@ -448,7 +446,6 @@ void rename_detection(struct manifest *manifest)
g_list_free(deleted_files);
}


/* What do we need this for?
*
* rename_detection has already set up the links in the manifest it
Expand Down
3 changes: 1 addition & 2 deletions src/xattrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ static int xattr_get_value(const char *path, const char *name, char **blob,

/* realloc needed len + 1 in case we need to add final zero
* to ensure consistent blob */
value = realloc(*blob, *blob_len + len +
(action == XATTRS_ACTION_GET_BLOB ? 1 : 0));
value = realloc(*blob, *blob_len + len + (action == XATTRS_ACTION_GET_BLOB ? 1 : 0));
assert(value);

*blob = value;
Expand Down

0 comments on commit 0d35288

Please sign in to comment.