Clean up white space.

This commit is contained in:
Jan Vidar Krey
2013-03-22 20:00:40 +01:00
parent 5835a06676
commit f25015927a
34 changed files with 232 additions and 232 deletions

View File

@@ -71,7 +71,7 @@ const char* auth_cred_to_string(enum auth_credentials cred)
case auth_cred_link: return "link";
case auth_cred_admin: return "admin";
}
return "";
};

View File

@@ -36,7 +36,7 @@ void flood_control_reset(struct flood_control*);
* @param max_count Max count for flood control
* @param window Time window for max_count to appear.
* @param now The current time.
*
*
* @return 0 if flood no flood detected.
* 1 if flood detected.
*/

View File

@@ -65,7 +65,7 @@ void list_append(struct linked_list* list, void* data_ptr)
return;
}
new_node->ptr = data_ptr;
if (list->last)
{
list->last->next = new_node;
@@ -123,10 +123,10 @@ void list_remove(struct linked_list* list, void* data_ptr)
{
if (node->next)
node->next->prev = node->prev;
if (node->prev)
node->prev->next = node->next;
if (node == list->last)
list->last = node->prev;
@@ -194,7 +194,7 @@ void* list_get_first(struct linked_list* list)
list->iterator = list->first;
if (list->iterator == NULL)
return NULL;
return list->iterator->ptr;
}
@@ -203,7 +203,7 @@ struct node* list_get_first_node(struct linked_list* list)
list->iterator = list->first;
if (list->iterator == NULL)
return NULL;
return list->iterator;
}
@@ -212,7 +212,7 @@ void* list_get_last(struct linked_list* list)
list->iterator = list->last;
if (list->iterator == NULL)
return NULL;
return list->iterator->ptr;
}
@@ -221,9 +221,9 @@ struct node* list_get_last_node(struct linked_list* list)
list->iterator = list->last;
if (list->iterator == NULL)
return NULL;
return list->iterator;
}
void* list_get_next(struct linked_list* list)
@@ -232,7 +232,7 @@ void* list_get_next(struct linked_list* list)
list->iterator = list->first;
else
list->iterator = list->iterator->next;
if (list->iterator == NULL)
return NULL;
@@ -244,9 +244,9 @@ void* list_get_prev(struct linked_list* list)
{
if (list->iterator == NULL)
return NULL;
list->iterator = list->iterator->prev;
if (list->iterator == NULL)
return NULL;

View File

@@ -86,7 +86,7 @@ void hub_log_initialize(const char* file, int syslog)
return;
}
#endif
#ifndef WIN32
if (syslog)
{
@@ -97,13 +97,13 @@ void hub_log_initialize(const char* file, int syslog)
}
#endif
if (!file)
{
logfile = stderr;
return;
}
logfile = fopen(file, "a");
if (!logfile)
{
@@ -137,7 +137,7 @@ void hub_log_shutdown()
netdump = NULL;
}
#endif
#ifndef WIN32
if (use_syslog)
{
@@ -186,7 +186,7 @@ void hub_log(int log_verbosity, const char *format, ...)
return;
}
#endif
if (log_verbosity < verbosity)
{
t = time(NULL);
@@ -195,7 +195,7 @@ void hub_log(int log_verbosity, const char *format, ...)
va_start(args, format);
vsnprintf(logmsg, 1024, format, args);
va_end(args);
if (logfile)
{
fprintf(logfile, "%s %6s: %s\n", timestamp, prefixes[log_verbosity], logmsg);
@@ -211,14 +211,14 @@ void hub_log(int log_verbosity, const char *format, ...)
if (use_syslog)
{
int level = 0;
if (verbosity < log_info)
return;
va_start(args, format);
vsnprintf(logmsg, 1024, format, args);
va_end(args);
switch (log_verbosity)
{
case log_fatal: level = LOG_CRIT; break;
@@ -232,15 +232,15 @@ void hub_log(int log_verbosity, const char *format, ...)
#endif
case log_info: level = LOG_INFO; break;
case log_debug: level = LOG_DEBUG; break;
default:
level = 0;
break;
}
if (level == 0)
return;
#ifdef SYSTEMD
sd_journal_print(level, "%s", logmsg);
@@ -250,5 +250,5 @@ void hub_log(int log_verbosity, const char *format, ...)
#endif
}
#endif
}

View File

@@ -48,7 +48,7 @@ void internal_debug_print_leaks()
size_t leak = 0;
size_t count = 0;
LOG_MEMORY("--- exit (allocs: %d, size: " PRINTF_SIZE_T ") ---", hub_alloc_count, hub_alloc_size);
for (; n < UHUB_MAX_ALLOCS; n++)
{
if (hub_allocs[n].ptr)
@@ -58,7 +58,7 @@ void internal_debug_print_leaks()
LOG_MEMORY("leak %p size: " PRINTF_SIZE_T " (bt: %p %p)", hub_allocs[n].ptr, hub_allocs[n].size, hub_allocs[n].stack1, hub_allocs[n].stack2);
}
}
LOG_MEMORY("--- done (allocs: %d, size: " PRINTF_SIZE_T ", peak: %d/" PRINTF_SIZE_T ", oom: " PRINTF_SIZE_T ") ---", count, leak, hub_alloc_peak_count, hub_alloc_peak_size, hub_alloc_oom);
}
#endif /* REALTIME_MALLOC_TRACKING */
@@ -67,9 +67,9 @@ void* internal_debug_mem_malloc(size_t size, const char* where)
{
size_t n = 0;
char* ptr = malloc(size);
#ifdef REALTIME_MALLOC_TRACKING
/* Make sure the malloc info struct is initialized */
if (!hub_alloc_count)
{
@@ -81,17 +81,17 @@ void* internal_debug_mem_malloc(size_t size, const char* where)
hub_allocs[n].stack1 = 0;
hub_allocs[n].stack2 = 0;
}
atexit(&internal_debug_print_leaks);
}
if (ptr)
{
if (malloc_slot != -1)
n = (size_t) malloc_slot;
else
n = 0;
for (; n < UHUB_MAX_ALLOCS; n++)
{
if (!hub_allocs[n].ptr)
@@ -100,13 +100,13 @@ void* internal_debug_mem_malloc(size_t size, const char* where)
hub_allocs[n].size = size;
hub_allocs[n].stack1 = __builtin_return_address(1);
hub_allocs[n].stack2 = __builtin_return_address(2);
hub_alloc_size += size;
hub_alloc_count++;
hub_alloc_peak_count = MAX(hub_alloc_count, hub_alloc_peak_count);
hub_alloc_peak_size = MAX(hub_alloc_size, hub_alloc_peak_size);
LOG_MEMORY("%s %p (%d bytes) (bt: %p %p) {allocs: %d, size: " PRINTF_SIZE_T "}", where, ptr, (int) size, hub_allocs[n].stack1, hub_allocs[n].stack2, hub_alloc_count, hub_alloc_size);
break;
}
@@ -147,7 +147,7 @@ void internal_debug_mem_free(void* ptr)
return;
}
}
malloc_slot = -1;
abort();
LOG_MEMORY("free %p *** NOT ALLOCATED *** (bt: %p %p)", ptr, stack1, stack2);

View File

@@ -37,7 +37,7 @@ static int is_printable(unsigned char c)
{
if (c >= 32)
return 1;
if (c == '\t' || c == '\r' || c == '\n')
return 1;
return 0;
@@ -59,7 +59,7 @@ char* strip_white_space(char* string)
/* Strip appending whitespace */
pos = &string[strlen(string)-1];
while (&string[0] < &pos[0] && is_white_space(pos[0])) { pos[0] = 0; pos--; }
return string;
}
@@ -68,9 +68,9 @@ static int is_valid_utf8_str(const char* string, size_t length)
int expect = 0;
char div = 0;
size_t pos = 0;
if (length == 0) return 1;
for (pos = 0; pos < length; pos++)
{
if (expect)
@@ -243,7 +243,7 @@ int file_read_lines(const char* file, void* data, file_line_handler_t handler)
LOG_ERROR("Unable to open file %s: %s", file, strerror(errno));
return -2;
}
ret = read(fd, buf, MAX_RECV_BUF-1);
close(fd);
@@ -274,12 +274,12 @@ int uhub_atoi(const char* value) {
int val = 0;
int i = 0;
for (; i < len; i++)
if (value[i] > '9' || value[i] < '0')
if (value[i] > '9' || value[i] < '0')
offset++;
for (i = offset; i< len; i++)
for (i = offset; i< len; i++)
val = val*10 + (value[i] - '0');
return value[0] == '-' ? -val : val;
}
@@ -360,7 +360,7 @@ void* memmem(const void *haystack, size_t haystacklen, const void *needle, size_
char* c_buf = (char*) haystack;
char* c_pat = (char*) needle;
char* ptr = memchr(c_buf, c_pat[0], haystacklen);
while (ptr && ((size_t) (&ptr[0] - &c_buf[0]) < haystacklen))
{
if (!memcmp(ptr, c_pat, needlelen))
@@ -382,7 +382,7 @@ int split_string(const char* string, const char* split, struct linked_list* list
for (;;)
{
tmp1 = strstr(string, split);
if (tmp1) tmp2 = hub_strndup(string, tmp1 - string);
else tmp2 = hub_strdup(string);

View File

@@ -57,7 +57,7 @@ void tiger_compress(uint64_t* str, uint64_t state[3]) {
a = state[0];
b = state[1];
c = state[2];
x0 = str[0];
x1 = str[1];
x2 = str[2];
@@ -70,7 +70,7 @@ void tiger_compress(uint64_t* str, uint64_t state[3]) {
aa = a;
bb = b;
cc = c;
PASS(a, b, c, 5);
x0 -= x7 ^ 0xA5A5A5A5A5A5A5A5ULL;
@@ -91,7 +91,7 @@ void tiger_compress(uint64_t* str, uint64_t state[3]) {
x7 -= x6 ^ 0x0123456789ABCDEFULL;
PASS(c, a, b, 7);
x0 -= x7 ^ 0xA5A5A5A5A5A5A5A5ULL;
x1 ^= x0;
x2 += x1;
@@ -130,9 +130,9 @@ void tiger_compress(uint64_t* str, uint64_t state[3]) {
x5 ^= x4;
x6 += x5;
x7 -= x6 ^ 0x0123456789ABCDEFULL;
PASS(a, b, c, 9);
swap = a;
a = c;
c = b;
@@ -143,7 +143,7 @@ void tiger_compress(uint64_t* str, uint64_t state[3]) {
a ^= aa;
b -= bb;
c += cc;
state[0] = a;
state[1] = b;
state[2] = c;
@@ -207,7 +207,7 @@ void tiger(uint64_t* str, uint64_t length, uint64_t res[3]) {
}
for (; j < 56; j++) temp[j] = 0;
((uint64_t*) (&(temp[56])))[0] = ((uint64_t) length) << 3;
tiger_compress(((uint64_t*) temp), res);