This commit is contained in:
Ashish Kumar Yadav 2020-07-29 23:37:56 +05:30
parent edb5931419
commit ef2634566c

View file

@ -13,7 +13,7 @@
#define LOCKFILE "/tmp/dwmblocks.pid" #define LOCKFILE "/tmp/dwmblocks.pid"
#define NILL INT_MIN #define NILL INT_MIN
#define EMPTYCMDOUT(block) (*(block->cmdoutcur) == '\n' || *(block->cmdoutcur) == '\0') #define EMPTYCMDOUT(block) (*block->cmdoutcur == '\n' || *block->cmdoutcur == '\0')
typedef struct { typedef struct {
char *pathu; char *pathu;
@ -216,8 +216,8 @@ updatestatus()
/* checking half of the function */ /* checking half of the function */
/* skip empty blocks */ /* skip empty blocks */
while (current->pathu && EMPTYCMDOUT(current)) { while (current->pathu && EMPTYCMDOUT(current)) {
if (*(current->cmdoutprv) != *(current->cmdoutcur)) { if (*current->cmdoutcur != *current->cmdoutprv) {
*(current->cmdoutprv) = *(current->cmdoutcur); *current->cmdoutprv = *current->cmdoutcur;
current++; current++;
goto update0; goto update0;
} }
@ -235,12 +235,12 @@ skipdelimc:
c = current->cmdoutcur; p = current->cmdoutprv; c = current->cmdoutcur; p = current->cmdoutprv;
do { do {
if (*c != *p) { if (*c != *p) {
s += (c - current->cmdoutcur); s += c - current->cmdoutcur;
goto update1; goto update1;
} }
c++; p++; c++; p++;
} while (*c != '\n' && *c != '\0'); } while (*c != '\n' && *c != '\0');
s += (c - current->cmdoutcur); s += c - current->cmdoutcur;
if (current->pathc && current->signal) if (current->pathc && current->signal)
s++; s++;
} }
@ -249,7 +249,7 @@ update0:
/* updating half of the function */ /* updating half of the function */
/* skip empty blocks */ /* skip empty blocks */
while (current->pathu && EMPTYCMDOUT(current)) { while (current->pathu && EMPTYCMDOUT(current)) {
*(current->cmdoutprv) = *(current->cmdoutcur); *current->cmdoutprv = *current->cmdoutcur;
current++; current++;
} }
/* skip delimiter in front of the first non-empty block */ /* skip delimiter in front of the first non-empty block */
@ -269,7 +269,7 @@ update1:
do { do {
*(s++) = *c; *(s++) = *c;
*p = *c; *p = *c;
p++; c++; c++; p++;
} while (*c != '\n' && *c != '\0'); } while (*c != '\n' && *c != '\0');
if (current->pathc && current->signal) if (current->pathc && current->signal)
*(s++) = current->signal; *(s++) = current->signal;