Merge pull request #2751 from AiyionPrime/c-indentation

C indentation
This commit is contained in:
Jan-Niklas Burfeind 2023-01-15 15:53:27 +01:00 committed by GitHub
commit 0e5a5d31f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 1053 additions and 1057 deletions

View File

@ -37,7 +37,7 @@ static struct json_object * get_autoupdater(void) {
return ret; return ret;
error: error:
uci_free_context(ctx); uci_free_context(ctx);
return NULL; return NULL;
} }

View File

@ -159,15 +159,15 @@ and these came close:
/* /*
-------------------------------------------------------------------- --------------------------------------------------------------------
This works on all machines. To be useful, it requires This works on all machines. To be useful, it requires
-- that the key be an array of uint32_t's, and -- that the key be an array of uint32_t's, and
-- that the length be the number of uint32_t's in the key -- that the length be the number of uint32_t's in the key
The function hashword() is identical to hashlittle() on little-endian The function hashword() is identical to hashlittle() on little-endian
machines, and identical to hashbig() on big-endian machines, machines, and identical to hashbig() on big-endian machines,
except that the length has to be measured in uint32_ts rather than in except that the length has to be measured in uint32_ts rather than in
bytes. hashlittle() is more complicated than hashword() only because bytes. hashlittle() is more complicated than hashword() only because
hashlittle() has to dance around fitting the key bytes into registers. hashlittle() has to dance around fitting the key bytes into registers.
-------------------------------------------------------------------- --------------------------------------------------------------------
*/ */
uint32_t hashword( uint32_t hashword(
@ -215,10 +215,10 @@ both be initialized with seeds. If you pass in (*pb)==0, the output
-------------------------------------------------------------------- --------------------------------------------------------------------
*/ */
void hashword2 ( void hashword2 (
const uint32_t *k, /* the key, an array of uint32_t values */ const uint32_t *k, /* the key, an array of uint32_t values */
size_t length, /* the length of the key, in uint32_ts */ size_t length, /* the length of the key, in uint32_ts */
uint32_t *pc, /* IN: seed OUT: primary hash value */ uint32_t *pc, /* IN: seed OUT: primary hash value */
uint32_t *pb) /* IN: more seed OUT: secondary hash value */ uint32_t *pb) /* IN: more seed OUT: secondary hash value */
{ {
uint32_t a,b,c; uint32_t a,b,c;
@ -442,7 +442,6 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
case 0 : return c; case 0 : return c;
} }
} }
final(a,b,c); final(a,b,c);
return c; return c;
} }
@ -671,7 +670,7 @@ uint32_t hashbig( const void *key, size_t length, uint32_t initval)
* does it on word boundaries, so is OK with this. But VALGRIND will * does it on word boundaries, so is OK with this. But VALGRIND will
* still catch it and complain. The masking trick does make the hash * still catch it and complain. The masking trick does make the hash
* noticeably faster for short strings (like English words). * noticeably faster for short strings (like English words).
*/ * */
#ifndef VALGRIND #ifndef VALGRIND
switch(length) switch(length)
@ -802,11 +801,10 @@ void driver2()
{ {
for (j=0; j<8; ++j) /*------------------------ for each input bit, */ for (j=0; j<8; ++j) /*------------------------ for each input bit, */
{ {
for (m=1; m<8; ++m) /*------------ for several possible initvals, */ for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */
{ {
for (l=0; l<HASHSTATE; ++l) for (l=0; l<HASHSTATE; ++l)
e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((uint32_t)0); e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((uint32_t)0);
/*---- check that every output bit is affected by that input bit */ /*---- check that every output bit is affected by that input bit */
for (k=0; k<MAXPAIR; k+=2) for (k=0; k<MAXPAIR; k+=2)
{ {
@ -845,7 +843,7 @@ void driver2()
} }
} }
} }
done: done:
if (z < MAXPAIR) if (z < MAXPAIR)
{ {
printf("Mix success %2d bytes %2d initvals ",i,m); printf("Mix success %2d bytes %2d initvals ",i,m);
@ -947,7 +945,7 @@ void driver3()
} }
/* check for problems with nulls */ /* check for problems with nulls */
void driver4() void driver4()
{ {
uint8_t buf[1]; uint8_t buf[1];
uint32_t h,i,state[HASHSTATE]; uint32_t h,i,state[HASHSTATE];

View File

@ -214,7 +214,7 @@ static struct json_object * get_traffic(void) {
json_object_object_add(ret, "mgmt_rx", mgmt_rx); json_object_object_add(ret, "mgmt_rx", mgmt_rx);
json_object_object_add(ret, "mgmt_tx", mgmt_tx); json_object_object_add(ret, "mgmt_tx", mgmt_tx);
out: out:
free(stats); free(stats);
free(strings); free(strings);
close(fd); close(fd);

View File

@ -320,7 +320,7 @@ static struct json_object * get_mesh_vpn(void) {
ret = get_peer_group(mesh_vpn_fastd, peers); ret = get_peer_group(mesh_vpn_fastd, peers);
end: end:
json_object_put(site); json_object_put(site);
json_object_put(status); json_object_put(status);

View File

@ -253,7 +253,7 @@ static void count_stations(size_t *wifi24, size_t *wifi5, size_t *owe24, size_t
count_iface_stations(wifi24, wifi5, ifname); count_iface_stations(wifi24, wifi5, ifname);
} }
end: end:
uci_free_context(ctx); uci_free_context(ctx);
} }

View File

@ -79,10 +79,8 @@ struct batadv_nlquery_opts {
* *
* Return: Return true when a attribute is missing, false otherwise * Return: Return true when a attribute is missing, false otherwise
*/ */
static inline bool static inline bool batadv_genl_missing_attrs(struct nlattr *attrs[],
batadv_genl_missing_attrs(struct nlattr *attrs[], const enum batadv_nl_attrs mandatory[], size_t num) {
const enum batadv_nl_attrs mandatory[], size_t num)
{
size_t i; size_t i;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {