apply clang-format

minus the bogus changes

Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
This commit is contained in:
NRK 2023-02-10 11:35:53 +06:00
parent 2434e83807
commit f2f4903de4
8 changed files with 110 additions and 87 deletions

View file

@ -28,7 +28,10 @@
#include <sys/inotify.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)
{
@ -94,7 +97,10 @@ bool arl_handle(arl_t *arl)
char *ptr;
const struct inotify_event *e;
/* 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) {
ssize_t len = read(arl->fd, buf.d, sizeof(buf.d));

View file

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

15
main.c
View file

@ -45,7 +45,8 @@
#define TV_DIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec ) * 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_usec += (t) % 1000 * 1000; \
} while (0)
@ -426,7 +427,8 @@ static void update_info(void)
/* update bar contents */
if (win.bar.h == 0 || extprefix)
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 ? "* " : "";
l->p = l->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, "%3d%%" BAR_SEP, (int)(img.zoom * 100.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", fw, fileidx + 1, filecnt);
@ -623,7 +626,8 @@ static bool run_key_handler(const char *key, unsigned int mask)
}
}
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++) {
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 */
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) {
img_close(&img, true);

View file

@ -43,7 +43,8 @@ void print_usage(void)
{
printf("usage: %s [-abcfhiopqrtvZ0] [-A FRAMERATE] [-e WID] [-G GAMMA] "
"[-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)

View file

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

3
util.c
View file

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

View file

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