apply clang-format

minus the bogus changes

Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
pull/323/head
NRK 1 year ago
parent 2434e83807
commit f2f4903de4

@ -28,7 +28,10 @@
#include <sys/inotify.h> #include <sys/inotify.h>
#include <unistd.h> #include <unistd.h>
static struct { char *buf; size_t len; } scratch; static struct {
char *buf;
size_t len;
} scratch;
void arl_init(arl_t *arl) void arl_init(arl_t *arl)
{ {
@ -94,7 +97,10 @@ bool arl_handle(arl_t *arl)
char *ptr; char *ptr;
const struct inotify_event *e; const struct inotify_event *e;
/* inotify_event aligned buffer */ /* inotify_event aligned buffer */
static union { char d[4096]; struct inotify_event e; } buf; static union {
char d[4096];
struct inotify_event e;
} buf;
while (true) { while (true) {
ssize_t len = read(arl->fd, buf.d, sizeof(buf.d)); ssize_t len = read(arl->fd, buf.d, sizeof(buf.d));

@ -343,7 +343,8 @@ bool ci_drag(arg_t drag_mode)
ButtonPressMask | ButtonReleaseMask | PointerMotionMask, &e); ButtonPressMask | ButtonReleaseMask | PointerMotionMask, &e);
if (e.type == ButtonPress || e.type == ButtonRelease) if (e.type == ButtonPress || e.type == ButtonRelease)
break; break;
while (XCheckTypedEvent(win.env.dpy, MotionNotify, &e)); while (XCheckTypedEvent(win.env.dpy, MotionNotify, &e))
;
ox = x; ox = x;
oy = y; oy = y;
x = e.xmotion.x; x = e.xmotion.x;
@ -443,7 +444,8 @@ bool ct_drag_mark_image(arg_t _)
ButtonPressMask | ButtonReleaseMask | PointerMotionMask, &e); ButtonPressMask | ButtonReleaseMask | PointerMotionMask, &e);
if (e.type == ButtonPress || e.type == ButtonRelease) if (e.type == ButtonPress || e.type == ButtonRelease)
break; break;
while (XCheckTypedEvent(win.env.dpy, MotionNotify, &e)); while (XCheckTypedEvent(win.env.dpy, MotionNotify, &e))
;
sel = tns_translate(&tns, e.xbutton.x, e.xbutton.y); sel = tns_translate(&tns, e.xbutton.x, e.xbutton.y);
} }
} }

@ -45,7 +45,8 @@
#define TV_DIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec ) * 1000 + \ #define TV_DIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec ) * 1000 + \
((t1)->tv_usec - (t2)->tv_usec) / 1000) ((t1)->tv_usec - (t2)->tv_usec) / 1000)
#define TV_ADD_MSEC(tv,t) do { \ #define TV_ADD_MSEC(tv, t) \
do { \
(tv)->tv_sec += (t) / 1000; \ (tv)->tv_sec += (t) / 1000; \
(tv)->tv_usec += (t) % 1000 * 1000; \ (tv)->tv_usec += (t) % 1000 * 1000; \
} while (0) } while (0)
@ -426,7 +427,8 @@ static void update_info(void)
/* update bar contents */ /* update bar contents */
if (win.bar.h == 0 || extprefix) if (win.bar.h == 0 || extprefix)
return; return;
for (fw = 0, i = filecnt; i > 0; fw++, i /= 10); for (fw = 0, i = filecnt; i > 0; fw++, i /= 10)
;
mark = files[fileidx].flags & FF_MARK ? "* " : ""; mark = files[fileidx].flags & FF_MARK ? "* " : "";
l->p = l->buf; l->p = l->buf;
r->p = r->buf; r->p = r->buf;
@ -454,7 +456,8 @@ static void update_info(void)
bar_put(r, "C%+d" BAR_SEP, img.contrast); bar_put(r, "C%+d" BAR_SEP, img.contrast);
bar_put(r, "%3d%%" BAR_SEP, (int)(img.zoom * 100.0)); bar_put(r, "%3d%%" BAR_SEP, (int)(img.zoom * 100.0));
if (img.multi.cnt > 0) { if (img.multi.cnt > 0) {
for (fn = 0, i = img.multi.cnt; i > 0; fn++, i /= 10); for (fn = 0, i = img.multi.cnt; i > 0; fn++, i /= 10)
;
bar_put(r, "%0*d/%d" BAR_SEP, fn, img.multi.sel + 1, img.multi.cnt); bar_put(r, "%0*d/%d" BAR_SEP, fn, img.multi.sel + 1, img.multi.cnt);
} }
bar_put(r, "%0*d/%d", fw, fileidx + 1, filecnt); bar_put(r, "%0*d/%d", fw, fileidx + 1, filecnt);
@ -623,7 +626,8 @@ static bool run_key_handler(const char *key, unsigned int mask)
} }
} }
fclose(pfs); fclose(pfs);
while (waitpid(pid, NULL, 0) == -1 && errno == EINTR); while (waitpid(pid, NULL, 0) == -1 && errno == EINTR)
;
for (f = i = 0; f < fcnt; i++) { for (f = i = 0; f < fcnt; i++) {
if ((marked && (files[i].flags & FF_MARK)) || (!marked && i == fileidx)) { if ((marked && (files[i].flags & FF_MARK)) || (!marked && i == fileidx)) {
@ -640,7 +644,8 @@ static bool run_key_handler(const char *key, unsigned int mask)
} }
} }
/* drop user input events that occurred while running the key handler */ /* drop user input events that occurred while running the key handler */
while (XCheckIfEvent(win.env.dpy, &dump, is_input_ev, NULL)); while (XCheckIfEvent(win.env.dpy, &dump, is_input_ev, NULL))
;
if (mode == MODE_IMAGE && changed) { if (mode == MODE_IMAGE && changed) {
img_close(&img, true); img_close(&img, true);

@ -43,7 +43,8 @@ void print_usage(void)
{ {
printf("usage: %s [-abcfhiopqrtvZ0] [-A FRAMERATE] [-e WID] [-G GAMMA] " printf("usage: %s [-abcfhiopqrtvZ0] [-A FRAMERATE] [-e WID] [-G GAMMA] "
"[-g GEOMETRY] [-N NAME] [-n NUM] [-S DELAY] [-s MODE] " "[-g GEOMETRY] [-N NAME] [-n NUM] [-S DELAY] [-s MODE] "
"[-z ZOOM] FILES...\n", progname); "[-z ZOOM] FILES...\n",
progname);
} }
static void print_version(void) static void print_version(void)

@ -343,10 +343,14 @@ bool tns_load(tns_t *tns, int n, bool force, bool cache_only)
} }
file->flags |= FF_TN_INIT; file->flags |= FF_TN_INIT;
if (n == tns->initnext) if (n == tns->initnext) {
while (++tns->initnext < *tns->cnt && ((++file)->flags & FF_TN_INIT)); while (++tns->initnext < *tns->cnt && ((++file)->flags & FF_TN_INIT))
if (n == tns->loadnext && !cache_only) ;
while (++tns->loadnext < tns->end && (++t)->im != NULL); }
if (n == tns->loadnext && !cache_only) {
while (++tns->loadnext < tns->end && (++t)->im != NULL)
;
}
return true; return true;
} }

@ -203,7 +203,8 @@ int r_mkdir(char *path)
s++; s++;
continue; continue;
} }
for (; *s != '\0' && *s != '/'; s++); for (; *s != '\0' && *s != '/'; s++)
;
c = *s; c = *s;
*s = '\0'; *s = '\0';
if (mkdir(path, 0755) == -1) { if (mkdir(path, 0755) == -1) {

@ -56,8 +56,12 @@ static struct {
int name; int name;
Cursor icon; Cursor icon;
} cursors[CURSOR_COUNT] = { } cursors[CURSOR_COUNT] = {
{ XC_left_ptr }, { XC_dotbox }, { XC_fleur }, { XC_watch }, { XC_left_ptr },
{ XC_sb_left_arrow }, { XC_sb_right_arrow } { XC_dotbox },
{ XC_fleur },
{ XC_watch },
{ XC_sb_left_arrow },
{ XC_sb_right_arrow }
}; };
#if HAVE_LIBFONTS #if HAVE_LIBFONTS

Loading…
Cancel
Save