Localize running and failure inside readpw()

They are only needed there, so don't make them global.
このコミットが含まれているのは:
Quentin Rameau 2016-09-01 13:47:19 +02:00 committed by Markus Teich
コミット 03a8717991
1個のファイルの変更4行の追加6行の削除

10
slock.c
ファイルの表示

@ -46,8 +46,6 @@ typedef struct {
static Lock **locks; static Lock **locks;
static int nscreens; static int nscreens;
static Bool running = True;
static Bool failure = False;
static Bool rr; static Bool rr;
static int rrevbase; static int rrevbase;
static int rrerrbase; static int rrerrbase;
@ -132,14 +130,15 @@ readpw(Display *dpy, const char *pws)
#endif #endif
{ {
char buf[32], passwd[256], *encrypted; char buf[32], passwd[256], *encrypted;
int num, screen; int num, screen, running, failure;
unsigned int len, color; unsigned int len, color;
KeySym ksym; KeySym ksym;
XEvent ev; XEvent ev;
static int oldc = INIT; static int oldc = INIT;
len = 0; len = 0;
running = True; running = 1;
failure = 0;
/* As "slock" stands for "Simple X display locker", the DPMS settings /* As "slock" stands for "Simple X display locker", the DPMS settings
* had been removed and you can set it with "xset" or some other * had been removed and you can set it with "xset" or some other
@ -253,7 +252,7 @@ lockscreen(Display *dpy, int screen)
XSetWindowAttributes wa; XSetWindowAttributes wa;
Cursor invisible; Cursor invisible;
if (!running || dpy == NULL || screen < 0 || !(lock = malloc(sizeof(Lock)))) if (dpy == NULL || screen < 0 || !(lock = malloc(sizeof(Lock))))
return NULL; return NULL;
lock->screen = screen; lock->screen = screen;
@ -376,7 +375,6 @@ main(int argc, char **argv) {
/* did we manage to lock everything? */ /* did we manage to lock everything? */
if (nlocks != nscreens) { if (nlocks != nscreens) {
running = 0;
cleanup(dpy); cleanup(dpy);
return 1; return 1;
} }