Coding style fixes, mostly indentation and whitespace

This commit is contained in:
Markus Armbruster 2010-05-18 22:09:01 +02:00
parent 8a0d117d45
commit 373651359e
47 changed files with 131 additions and 130 deletions

View file

@ -61,17 +61,17 @@ struct lwpProc *lwpCreate(int prio, void (*)(void *), int size,
int flags, char *name, int flags, char *name,
int argc, char **argv, void *ud); int argc, char **argv, void *ud);
void lwpExit(void); void lwpExit(void);
void lwpTerminate(struct lwpProc * p); void lwpTerminate(struct lwpProc *);
void lwpYield(void); void lwpYield(void);
int lwpSleepFd(int fd, int flags, struct timeval *timeout); int lwpSleepFd(int fd, int flags, struct timeval *timeout);
int lwpSleepUntil(time_t until); int lwpSleepUntil(time_t until);
void lwpWakeup(struct lwpProc *); void lwpWakeup(struct lwpProc *);
int lwpSigWait(sigset_t *set, int *sig); int lwpSigWait(sigset_t *set, int *sig);
void *lwpGetUD(struct lwpProc * p); void *lwpGetUD(struct lwpProc *);
void lwpSetUD(struct lwpProc * p, char *ud); void lwpSetUD(struct lwpProc *, char *ud);
int lwpSetPriority(int prio); int lwpSetPriority(int prio);
char *lwpName(struct lwpProc * p); char *lwpName(struct lwpProc *);
void lwpSetName(struct lwpProc * p, char *name); void lwpSetName(struct lwpProc *, char *name);
struct lwp_rwlock *lwp_rwlock_create(char *); struct lwp_rwlock *lwp_rwlock_create(char *);
void lwp_rwlock_destroy(struct lwp_rwlock *); void lwp_rwlock_destroy(struct lwp_rwlock *);

View file

@ -125,8 +125,8 @@ do_unit_move(struct emp_qelem *ulist, int *together,
} }
if (!skip) if (!skip)
nav_map(leader->x, leader->y, nav_map(leader->x, leader->y,
type == EF_SHIP ? type == EF_SHIP
!(mchr[(int)leader->type].m_flags & M_SUB) : 1); ? !(mchr[(int)leader->type].m_flags & M_SUB) : 1);
else else
skip = 0; skip = 0;
sprintf(prompt, "<%.1f:%.1f: %s> ", *maxmob, sprintf(prompt, "<%.1f:%.1f: %s> ", *maxmob,

View file

@ -255,4 +255,3 @@ tran_nmap(coord curx, coord cury, char *arg)
{ {
return display_region_map(0, EF_NUKE, curx, cury, arg); return display_region_map(0, EF_NUKE, curx, cury, arg);
} }

View file

@ -117,7 +117,8 @@ weekday(char *str, int *wday)
*/ */
static char *day_name[7] = { static char *day_name[7] = {
"sunday", "monday", "tuesday", "wednesday", "sunday", "monday", "tuesday", "wednesday",
"thursday", "friday", "saturday" }; "thursday", "friday", "saturday"
};
int i, j; int i, j;
for (; isspace(*str); ++str) ; for (; isspace(*str); ++str) ;

View file

@ -84,7 +84,9 @@ mineq(char *a, char *b)
/* find common prefix: */ /* find common prefix: */
for (i = 0; a[i] != 0 && a[i] == b[i]; i++) ; for (i = 0; a[i] != 0 && a[i] == b[i]; i++) ;
if (a[i] != 0) return ME_MISMATCH; if (a[i] != 0)
if (b[i] == 0 || b[i] == ' ') return ME_EXACT; return ME_MISMATCH;
if (b[i] == 0 || b[i] == ' ')
return ME_EXACT;
return ME_PARTIAL; return ME_PARTIAL;
} }

View file

@ -199,8 +199,10 @@ static int
strnncmp(char *s1, size_t sz1, char *s2, size_t sz2) strnncmp(char *s1, size_t sz1, char *s2, size_t sz2)
{ {
int res; int res;
if (sz1 == sz2) return strncmp(s1, s2, sz2); if (sz1 == sz2)
if (sz1 < sz2) return -strnncmp(s2, sz2, s1, sz1); return strncmp(s1, s2, sz2);
if (sz1 < sz2)
return -strnncmp(s2, sz2, s1, sz1);
res = strncmp(s1, s2, sz2); res = strncmp(s1, s2, sz2);
return res ? res : s1[sz2]; return res ? res : s1[sz2];
} }
@ -278,7 +280,8 @@ nstr_parse_val(char *str, struct valstr *val)
val->val_cat = NSC_VAL; val->val_cat = NSC_VAL;
val->val_as.str.base = str + 1; val->val_as.str.base = str + 1;
val->val_as.str.maxsz = tail - (str + 1); val->val_as.str.maxsz = tail - (str + 1);
if (*tail) ++tail; if (*tail)
++tail;
/* FIXME else unclosed string */ /* FIXME else unclosed string */
return tail; return tail;
} }

View file

@ -619,8 +619,7 @@ ufindpfx(char *s, int n)
{ {
int i = 0; int i = 0;
while (n && s[i]) while (n && s[i]) {
{
if ((s[i++] & 0xc0) == 0xc0) if ((s[i++] & 0xc0) == 0xc0)
while ((s[i] & 0xc0) == 0x80) while ((s[i] & 0xc0) == 0x80)
i++; i++;

View file

@ -627,8 +627,7 @@ shp_fort_interdiction(struct emp_qelem *list, coord newx, coord newy,
mpr(victim, "Incoming fire does %d damage!\n", dam); mpr(victim, "Incoming fire does %d damage!\n", dam);
#if 0 #if 0
mpr(victim, "%s fires at you for %d!\n", mpr(victim, "%s fires at you for %d!\n",
xyas(fsect.sct_x,fsect.sct_y,victim), xyas(fsect.sct_x, fsect.sct_y, victim), dam);
dam);
#endif #endif
wu(0, fsect.sct_own, wu(0, fsect.sct_own,
"%s fires at %s ships in %s for %d!\n", "%s fires at %s ships in %s for %d!\n",

View file

@ -85,8 +85,7 @@ w32_set_winsock_errno(void)
WSASetLastError(0); WSASetLastError(0);
/* Map some WSAE* errors to the runtime library's error codes. */ /* Map some WSAE* errors to the runtime library's error codes. */
switch (err) switch (err) {
{
case WSA_INVALID_HANDLE: case WSA_INVALID_HANDLE:
errno = EBADF; errno = EBADF;
break; break;
@ -284,8 +283,7 @@ fcntl(int fd, int cmd, ...)
unsigned long nonblocking; unsigned long nonblocking;
SOCKET sock; SOCKET sock;
switch (cmd) switch (cmd) {
{
case F_GETFL: case F_GETFL:
return 0; return 0;
case F_SETFL: case F_SETFL: