Improved comments in updatestatus

This commit is contained in:
Ashish Kumar Yadav 2020-10-23 18:57:13 +05:30
parent 448cdeb3d1
commit b338589399

View file

@ -218,20 +218,19 @@ updatestatus()
/* all blocks are empty */ /* all blocks are empty */
if (!current->pathu) if (!current->pathu)
return 0; return 0;
/* contents of the current block just changed */ /* contents of the current block changed */
if (*current->cmdoutcur != *current->cmdoutprv) if (*current->cmdoutcur != *current->cmdoutprv)
goto update0; goto update0;
/* no delimiter before the first non-empty block */ /* skip delimiter handler for the first non-empty block */
if (*current->cmdoutcur != '\n' && *current->cmdoutcur != '\0') if (*current->cmdoutcur != '\n' && *current->cmdoutcur != '\0')
goto skipdelimc; goto skipdelimc;
} }
/* main loop */ /* main loop */
for (; current->pathu; current++) { for (; current->pathu; current++) {
/* contents of the current block just changed */ /* contents of the current block changed */
if (*current->cmdoutcur != *current->cmdoutprv) if (*current->cmdoutcur != *current->cmdoutprv)
goto update1; goto update1;
/* delimiter handler */ /* delimiter handler */
/* current block is non-empty */
if (*current->cmdoutcur != '\n' && *current->cmdoutcur != '\0') if (*current->cmdoutcur != '\n' && *current->cmdoutcur != '\0')
s += delimlength; s += delimlength;
/* skip over empty blocks */ /* skip over empty blocks */
@ -241,7 +240,7 @@ skipdelimc:
/* checking for the first byte has been done */ /* checking for the first byte has been done */
c = current->cmdoutcur + 1, p = current->cmdoutprv + 1; c = current->cmdoutcur + 1, p = current->cmdoutprv + 1;
for (; *c != '\n' && *c != '\0'; c++, p++) for (; *c != '\n' && *c != '\0'; c++, p++)
/* contents of the current block just changed */ /* contents of the current block changed */
if (*c != *p) { if (*c != *p) {
s += c - current->cmdoutcur; s += c - current->cmdoutcur;
goto update2; goto update2;
@ -260,7 +259,7 @@ skipdelimc:
if (!current->pathu) if (!current->pathu)
return 1; return 1;
update0: update0:
/* skip delimiter before the first non-empty block */ /* don't add delimiter before the first non-empty block */
if (*current->cmdoutcur != '\n' && *current->cmdoutcur != '\0') if (*current->cmdoutcur != '\n' && *current->cmdoutcur != '\0')
goto skipdelimu; goto skipdelimu;
*current->cmdoutprv = *current->cmdoutcur; *current->cmdoutprv = *current->cmdoutcur;
@ -269,7 +268,6 @@ update0:
for (; current->pathu; current++) { for (; current->pathu; current++) {
update1: update1:
/* delimiter handler */ /* delimiter handler */
/* current block is non-empty */
if (*current->cmdoutcur != '\n' && *current->cmdoutcur != '\0') { if (*current->cmdoutcur != '\n' && *current->cmdoutcur != '\0') {
d = delim; d = delim;
while (*d != '\0') while (*d != '\0')