tree-wide: minor formatting inconsistency cleanups

This commit is contained in:
Vito Caputo 2016-02-23 09:52:52 -08:00
parent c550f7a9b8
commit 9ed794a32d
46 changed files with 76 additions and 76 deletions

View File

@ -60,7 +60,7 @@
svg(" <text class=\"%s\" x=\"%.03f\" y=\"%.03f\">", (b) ? "left" : "right", SCALE_X * (x) + (b ? 5.0 : -5.0), SCALE_Y * (y) + 14.0); \
svg(format, ## __VA_ARGS__); \
svg("</text>\n"); \
} while(false)
} while (false)
static enum dot {
DEP_ALL,

View File

@ -50,7 +50,7 @@ uint32_t MurmurHash2 ( const void * key, int len, uint32_t seed )
const unsigned char * data = (const unsigned char *)key;
while(len >= 4)
while (len >= 4)
{
uint32_t k = *(uint32_t*)data;

View File

@ -114,7 +114,7 @@ static void sort_chain(CalendarComponent **c) {
static void fix_year(CalendarComponent *c) {
/* Turns 12 → 2012, 89 → 1989 */
while(c) {
while (c) {
CalendarComponent *n = c->next;
if (c->value >= 0 && c->value < 70)

View File

@ -1248,7 +1248,7 @@ int cg_pid_get_path_shifted(pid_t pid, const char *root, char **cgroup) {
return 0;
}
int cg_path_decode_unit(const char *cgroup, char **unit){
int cg_path_decode_unit(const char *cgroup, char **unit) {
char *c, *s;
size_t n;

View File

@ -46,7 +46,7 @@ ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length);
char *_s = (char *)(s); \
_i->iov_base = _s; \
_i->iov_len = strlen(_s); \
} while(false)
} while (false)
static inline size_t IOVEC_TOTAL_SIZE(const struct iovec *i, unsigned n) {
unsigned j;

View File

@ -32,7 +32,7 @@
#define LIST_HEAD_INIT(head) \
do { \
(head) = NULL; } \
while(false)
while (false)
/* Initialize a list item */
#define LIST_INIT(name,item) \
@ -40,7 +40,7 @@
typeof(*(item)) *_item = (item); \
assert(_item); \
_item->name##_prev = _item->name##_next = NULL; \
} while(false)
} while (false)
/* Prepend an item to the list */
#define LIST_PREPEND(name,head,item) \
@ -51,7 +51,7 @@
_item->name##_next->name##_prev = _item; \
_item->name##_prev = NULL; \
*_head = _item; \
} while(false)
} while (false)
/* Append an item to the list */
#define LIST_APPEND(name,head,item) \
@ -59,7 +59,7 @@
typeof(*(head)) *_tail; \
LIST_FIND_TAIL(name,head,_tail); \
LIST_INSERT_AFTER(name,head,_tail,item); \
} while(false)
} while (false)
/* Remove an item from the list */
#define LIST_REMOVE(name,head,item) \
@ -75,7 +75,7 @@
*_head = _item->name##_next; \
} \
_item->name##_next = _item->name##_prev = NULL; \
} while(false)
} while (false)
/* Find the head of the list */
#define LIST_FIND_HEAD(name,item,head) \
@ -119,7 +119,7 @@
_b->name##_prev = _a; \
_a->name##_next = _b; \
} \
} while(false)
} while (false)
/* Insert an item before another one (a = where, b = what) */
#define LIST_INSERT_BEFORE(name,head,a,b) \
@ -145,7 +145,7 @@
_b->name##_next = _a; \
_a->name##_prev = _b; \
} \
} while(false)
} while (false)
#define LIST_JUST_US(name,item) \
(!(item)->name##_prev && !(item)->name##_next) \

View File

@ -193,7 +193,7 @@ void log_assert_failed_return(
#ifdef LOG_TRACE
# define log_trace(...) log_debug(__VA_ARGS__)
#else
# define log_trace(...) do {} while(0)
# define log_trace(...) do {} while (0)
#endif
/* Structured logging */

View File

@ -224,7 +224,7 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
/* We override the glibc assert() here. */
#undef assert
#ifdef NDEBUG
#define assert(expr) do {} while(false)
#define assert(expr) do {} while (false)
#else
#define assert(expr) assert_message_se(expr, #expr)
#endif

View File

@ -505,7 +505,7 @@ int parse_fractional_part_u(const char **p, size_t digits, unsigned *res) {
s = *p;
/* accept any number of digits, strtoull is limted to 19 */
for(i=0; i < digits; i++,s++) {
for (i=0; i < digits; i++,s++) {
if (*s < '0' || *s > '9') {
if (i == 0)
return -EINVAL;

View File

@ -73,4 +73,4 @@ do { \
assert_not_reached("Unknown format string argument."); \
} \
} \
} while(false)
} while (false)

View File

@ -281,9 +281,9 @@ EFI_STATUS graphics_splash(UINT8 *content, UINTN len, const EFI_GRAPHICS_OUTPUT_
if (EFI_ERROR(err))
goto err;
if(dib->x < GraphicsOutput->Mode->Info->HorizontalResolution)
if (dib->x < GraphicsOutput->Mode->Info->HorizontalResolution)
x_pos = (GraphicsOutput->Mode->Info->HorizontalResolution - dib->x) / 2;
if(dib->y < GraphicsOutput->Mode->Info->VerticalResolution)
if (dib->y < GraphicsOutput->Mode->Info->VerticalResolution)
y_pos = (GraphicsOutput->Mode->Info->VerticalResolution - dib->y) / 2;
uefi_call_wrapper(GraphicsOutput->Blt, 10, GraphicsOutput,

View File

@ -119,7 +119,7 @@ int config_parse_unit_deps(
assert(rvalue);
p = rvalue;
for(;;) {
for (;;) {
_cleanup_free_ char *word = NULL, *k = NULL;
int r;
@ -1599,7 +1599,7 @@ int config_parse_service_sockets(
assert(data);
p = rvalue;
for(;;) {
for (;;) {
_cleanup_free_ char *word = NULL, *k = NULL;
r = extract_first_word(&p, &word, NULL, 0);
@ -3361,7 +3361,7 @@ int config_parse_protect_home(
ProtectHome h;
h = protect_home_from_string(rvalue);
if (h < 0){
if (h < 0) {
log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse protect home value, ignoring: %s", rvalue);
return 0;
}
@ -3404,7 +3404,7 @@ int config_parse_protect_system(
ProtectSystem s;
s = protect_system_from_string(rvalue);
if (s < 0){
if (s < 0) {
log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse protect system value, ignoring: %s", rvalue);
return 0;
}

View File

@ -431,7 +431,7 @@ finish:
hashmap_free_free(top);
hashmap_free_free(bottom);
HASHMAP_FOREACH_KEY(h, key, drops, i){
HASHMAP_FOREACH_KEY(h, key, drops, i) {
hashmap_free_free(hashmap_remove(drops, key));
hashmap_remove(drops, key);
free(key);

View File

@ -391,7 +391,7 @@
entry = document.getElementById("tableentry");
var buf = "";
for (var key in d){
for (var key in d) {
var data = d[key];
if (data == null)

View File

@ -75,7 +75,7 @@ static void close_fd_input(Uploader *u);
curl_easy_strerror(code)); \
cmd; \
} \
} while(0)
} while (0)
static size_t output_callback(char *buf,
size_t size,

View File

@ -50,7 +50,7 @@
*_f = alloca(_fl + 10); \
memcpy(*_f, "CODE_FUNC=", 10); \
memcpy(*_f + 10, _func, _fl); \
} while(false)
} while (false)
/* We open a single fd, and we'll share it with the current process,
* all its threads, and all its subprocesses. This means we need to

View File

@ -97,20 +97,20 @@ static void flush_progress(void) {
fflush(stdout);
}
#define debug(_offset, _fmt, ...) do{ \
#define debug(_offset, _fmt, ...) do { \
flush_progress(); \
log_debug(OFSfmt": " _fmt, _offset, ##__VA_ARGS__); \
} while(0)
} while (0)
#define warning(_offset, _fmt, ...) do{ \
#define warning(_offset, _fmt, ...) do { \
flush_progress(); \
log_warning(OFSfmt": " _fmt, _offset, ##__VA_ARGS__); \
} while(0)
} while (0)
#define error(_offset, _fmt, ...) do{ \
#define error(_offset, _fmt, ...) do { \
flush_progress(); \
log_error(OFSfmt": " _fmt, (uint64_t)_offset, ##__VA_ARGS__); \
} while(0)
} while (0)
static int journal_file_object_verify(JournalFile *f, uint64_t offset, Object *o) {
uint64_t i;

View File

@ -1407,7 +1407,7 @@ static int server_parse_proc_cmdline(Server *s) {
}
p = line;
for(;;) {
for (;;) {
_cleanup_free_ char *word = NULL;
r = extract_first_word(&p, &word, NULL, 0);

View File

@ -1063,7 +1063,7 @@ _public_ int sd_journal_test_cursor(sd_journal *j, const char *cursor) {
if (r < 0)
return r;
for(;;) {
for (;;) {
_cleanup_free_ char *item = NULL;
unsigned long long ll;
sd_id128_t id;

View File

@ -482,7 +482,7 @@ int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, size_t
return -ENOMEM;
entry = strndup(word, len);
if(!entry)
if (!entry)
return -ENOMEM;
tok = entry;

View File

@ -456,7 +456,7 @@ int sd_ipv4acd_set_callback(sd_ipv4acd *ll, sd_ipv4acd_callback_t cb, void *user
return 0;
}
int sd_ipv4acd_set_address(sd_ipv4acd *ll, const struct in_addr *address){
int sd_ipv4acd_set_address(sd_ipv4acd *ll, const struct in_addr *address) {
assert_return(ll, -EINVAL);
assert_return(address, -EINVAL);
assert_return(ll->state == IPV4ACD_STATE_INIT, -EBUSY);

View File

@ -181,7 +181,7 @@ int sd_ipv4ll_set_callback(sd_ipv4ll *ll, sd_ipv4ll_callback_t cb, void *userdat
return 0;
}
int sd_ipv4ll_get_address(sd_ipv4ll *ll, struct in_addr *address){
int sd_ipv4ll_get_address(sd_ipv4ll *ll, struct in_addr *address) {
assert_return(ll, -EINVAL);
assert_return(address, -EINVAL);

View File

@ -145,7 +145,7 @@ static int add_enumerated_to_set(
continue;
}
if (!object_path_is_valid(*k)){
if (!object_path_is_valid(*k)) {
free(*k);
r = -EINVAL;
continue;

View File

@ -528,7 +528,7 @@ static int netlink_message_read_internal(sd_netlink_message *m, unsigned short t
attribute = &m->containers[m->n_containers].attributes[type];
if(!attribute->offset)
if (!attribute->offset)
return -ENODATA;
rta = (struct rtattr*)((uint8_t *) m->hdr + attribute->offset);
@ -735,7 +735,7 @@ static int netlink_container_parse(sd_netlink_message *m,
_cleanup_free_ struct netlink_attribute *attributes = NULL;
attributes = new0(struct netlink_attribute, count);
if(!attributes)
if (!attributes)
return -ENOMEM;
for (; RTA_OK(rta, rt_len); rta = RTA_NEXT(rta, rt_len)) {

View File

@ -310,7 +310,7 @@ int machine_load(Machine *m) {
int *ni = NULL;
p = netif;
for(;;) {
for (;;) {
_cleanup_free_ char *word = NULL;
int ifi;

View File

@ -1212,7 +1212,7 @@ int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_err
r = unit_name_from_dbus_path(path, &unit);
if (r == -EINVAL) /* not for a unit */
return 0;
if (r < 0){
if (r < 0) {
log_oom();
return 0;
}

View File

@ -37,7 +37,7 @@ int fdb_entry_new_static(Network *const network,
assert(network);
/* search entry in hashmap first. */
if(section) {
if (section) {
fdb_entry = hashmap_get(network->fdb_entries_by_section, UINT_TO_PTR(section));
if (fdb_entry) {
*ret = fdb_entry;
@ -141,10 +141,10 @@ int fdb_entry_configure(Link *const link, FdbEntry *const fdb_entry) {
/* remove and FDB entry. */
void fdb_entry_free(FdbEntry *fdb_entry) {
if(!fdb_entry)
if (!fdb_entry)
return;
if(fdb_entry->network) {
if (fdb_entry->network) {
LIST_REMOVE(static_fdb_entries, fdb_entry->network->static_fdb_entries,
fdb_entry);

View File

@ -165,7 +165,7 @@ static int ipv4ll_address_claimed(sd_ipv4ll *ll, Link *link) {
return 0;
}
static void ipv4ll_handler(sd_ipv4ll *ll, int event, void *userdata){
static void ipv4ll_handler(sd_ipv4ll *ll, int event, void *userdata) {
Link *link = userdata;
int r;

View File

@ -1031,7 +1031,7 @@ static int link_set_bridge_fdb(Link *const link) {
LIST_FOREACH(static_fdb_entries, fdb_entry, link->network->static_fdb_entries) {
r = fdb_entry_configure(link, fdb_entry);
if(r < 0) {
if (r < 0) {
log_link_error_errno(link, r, "Failed to add MAC entry to static MAC table: %m");
break;
}
@ -1836,7 +1836,7 @@ static int link_joined(Link *link) {
}
}
if(link->network->bridge) {
if (link->network->bridge) {
r = link_set_bridge(link);
if (r < 0)
log_link_error_errno(link, r, "Could not set bridge message: %m");

View File

@ -88,7 +88,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
assert(t);
if(t->user_name) {
if (t->user_name) {
user = t->user_name;
@ -127,7 +127,7 @@ static int netdev_create_tuntap(NetDev *netdev) {
int r;
r = netdev_fill_tuntap_message(netdev, &ifr);
if(r < 0)
if (r < 0)
return r;
return netdev_tuntap_add(netdev, &ifr);

View File

@ -54,13 +54,13 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LINK attribute: %m");
if(v->ttl) {
if (v->ttl) {
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TTL attribute: %m");
}
if(v->tos) {
if (v->tos) {
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_TOS, v->tos);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TOS attribute: %m");
@ -86,7 +86,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L3MISS attribute: %m");
if(v->fdb_ageing) {
if (v->fdb_ageing) {
r = sd_netlink_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_AGEING attribute: %m");

View File

@ -561,7 +561,7 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_CAPABILITY:
case ARG_DROP_CAPABILITY: {
p = optarg;
for(;;) {
for (;;) {
_cleanup_free_ char *t = NULL;
r = extract_first_word(&p, &t, ",", 0);
@ -3618,7 +3618,7 @@ int main(int argc, char *argv[]) {
/* We failed to wait for the container, or the
* container exited abnormally */
goto finish;
else if (r > 0 || container_status == CONTAINER_TERMINATED){
else if (r > 0 || container_status == CONTAINER_TERMINATED) {
/* The container exited with a non-zero
* status, or with zero status and no reboot
* was requested. */

View File

@ -59,7 +59,7 @@ int manager_parse_dns_server_string_and_warn(Manager *m, DnsServerType type, con
assert(m);
assert(string);
for(;;) {
for (;;) {
_cleanup_free_ char *word = NULL;
r = extract_first_word(&string, &word, NULL, 0);
@ -114,7 +114,7 @@ int manager_parse_search_domains_and_warn(Manager *m, const char *string) {
assert(m);
assert(string);
for(;;) {
for (;;) {
_cleanup_free_ char *word = NULL;
r = extract_first_word(&string, &word, NULL, EXTRACT_QUOTES);

View File

@ -38,8 +38,8 @@ static void rewind_dns_packet(DnsPacketRewinder *rewinder) {
dns_packet_rewind(rewinder->packet, rewinder->saved_rindex);
}
#define INIT_REWINDER(rewinder, p) do { rewinder.packet = p; rewinder.saved_rindex = p->rindex; } while(0)
#define CANCEL_REWINDER(rewinder) do { rewinder.packet = NULL; } while(0)
#define INIT_REWINDER(rewinder, p) do { rewinder.packet = p; rewinder.saved_rindex = p->rindex; } while (0)
#define CANCEL_REWINDER(rewinder) do { rewinder.packet = NULL; } while (0)
int dns_packet_new(DnsPacket **ret, DnsProtocol protocol, size_t mtu) {
DnsPacket *p;

View File

@ -843,7 +843,7 @@ int bus_print_property(const char *name, sd_bus_message *property, bool all) {
if (r < 0)
return r;
while((r = sd_bus_message_read_basic(property, SD_BUS_TYPE_STRING, &str)) > 0) {
while ((r = sd_bus_message_read_basic(property, SD_BUS_TYPE_STRING, &str)) > 0) {
_cleanup_free_ char *escaped = NULL;
if (first)

View File

@ -178,7 +178,7 @@ int config_parse_personality(const char *unit, const char *filename, unsigned li
assert(data); \
\
xs = new0(type, 1); \
if(!xs) \
if (!xs) \
return -ENOMEM; \
\
*xs = invalid; \

View File

@ -37,7 +37,7 @@
#include "string-util.h"
#include "strv.h"
#define USE(x, y) do{ (x) = (y); (y) = NULL; } while(0)
#define USE(x, y) do { (x) = (y); (y) = NULL; } while (0)
int parse_sleep_config(const char *verb, char ***_modes, char ***_states) {

View File

@ -1484,7 +1484,7 @@ static int list_dependencies_print(const char *name, int level, unsigned int bra
printf("%s", draw_special_char(last ? DRAW_TREE_RIGHT : DRAW_TREE_BRANCH));
}
if (arg_full){
if (arg_full) {
printf("%s\n", name);
return 0;
}
@ -6550,7 +6550,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
}
p = optarg;
for(;;) {
for (;;) {
_cleanup_free_ char *type = NULL;
r = extract_first_word(&p, &type, ",", 0);
@ -6600,7 +6600,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
return log_oom();
} else {
p = optarg;
for(;;) {
for (;;) {
_cleanup_free_ char *prop = NULL;
r = extract_first_word(&p, &prop, ",", 0);
@ -6785,7 +6785,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
}
p = optarg;
for(;;) {
for (;;) {
_cleanup_free_ char *s = NULL;
r = extract_first_word(&p, &s, ",", 0);

View File

@ -864,7 +864,7 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic
}
service = hashmap_get(all_services, name);
if (!service){
if (!service) {
log_debug("Ignoring %s symlink in %s, not generating %s.", de->d_name, rcnd_table[i].path, name);
continue;
}

View File

@ -68,10 +68,10 @@ static int test_tunnel_configure(sd_netlink *rtnl) {
/* skip test if module cannot be loaded */
r = load_module("ipip");
if(r < 0)
if (r < 0)
return EXIT_TEST_SKIP;
if(getuid() != 0)
if (getuid() != 0)
return EXIT_TEST_SKIP;
/* IPIP tunnel */
@ -99,7 +99,7 @@ static int test_tunnel_configure(sd_netlink *rtnl) {
assert_se((m = sd_netlink_message_unref(m)) == NULL);
r = load_module("sit");
if(r < 0)
if (r < 0)
return EXIT_TEST_SKIP;
/* sit */

View File

@ -93,7 +93,7 @@ static void check_stop_unlink(Manager *m, Unit *unit, const char *test_path, con
ts = now(CLOCK_MONOTONIC);
/* We process events until the service related to the path has been successfully started */
while(service->result != SERVICE_SUCCESS || service->state != SERVICE_START) {
while (service->result != SERVICE_SUCCESS || service->state != SERVICE_START) {
usec_t n;
int r;

View File

@ -606,7 +606,7 @@ static void test_install_printf(void) {
} else assert_se(t == NULL); \
strcpy(i.name, d1); \
strcpy(i.path, d2); \
} while(false)
} while (false)
expect(i, "%n", "name.service");
expect(i, "%N", "name");

View File

@ -73,7 +73,7 @@ void probe_smart_media(int mtd_fd, mtd_info_t* info)
for (offset = 0 ; offset < block_size * spare_count ;
offset += sector_size) {
lseek(mtd_fd, SEEK_SET, offset);
if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){
if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE) {
cis_found = 1;
break;
}

View File

@ -177,7 +177,7 @@ static bool test_pointers(struct udev_device *dev,
has_mt_coordinates = test_bit(ABS_MT_POSITION_X, bitmask_abs) && test_bit(ABS_MT_POSITION_Y, bitmask_abs);
/* unset has_mt_coordinates if devices claims to have all abs axis */
if(has_mt_coordinates && test_bit(ABS_MT_SLOT, bitmask_abs) && test_bit(ABS_MT_SLOT - 1, bitmask_abs))
if (has_mt_coordinates && test_bit(ABS_MT_SLOT, bitmask_abs) && test_bit(ABS_MT_SLOT - 1, bitmask_abs))
has_mt_coordinates = false;
is_direct = test_bit(INPUT_PROP_DIRECT, bitmask_props);
has_touch = test_bit(BTN_TOUCH, bitmask_key);

View File

@ -100,7 +100,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
udev_list_init(udev, &subsystem_match_list, true);
udev_list_init(udev, &tag_match_list, true);
while((c = getopt_long(argc, argv, "pekus:t:h", options, NULL)) >= 0)
while ((c = getopt_long(argc, argv, "pekus:t:h", options, NULL)) >= 0)
switch (c) {
case 'p':
case 'e':

View File

@ -61,7 +61,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) {
log_debug("version %s", VERSION);
while((c = getopt_long(argc, argv, "a:N:h", options, NULL)) >= 0)
while ((c = getopt_long(argc, argv, "a:N:h", options, NULL)) >= 0)
switch (c) {
case 'a':
action = optarg;