Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Misaligned code?



Is this just misaligned, as the warning says, or is there something else
going on?  I don't think it was just tab confusion, though there are
tabs around.

gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I.  -DHAVE_CONFIG_H -DMODULE -Wall -Wmissing-prototypes -ggdb -fPIC -o computil..o computil.c
computil.c: In function ‘ca_get_opt’:
computil.c:1698:6: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
      if ((p->type == CAO_OEQUAL || p->type == CAO_EQUAL) &&
      ^~
computil.c:1702:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
   if (end) {
   ^~

pws

diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 0025dc3..c781673 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -1694,10 +1694,10 @@ ca_get_opt(Cadef d, char *line, int full, char **end)
 	for (p = d->opts; p; p = p->next)
 	    if (p->active && ((!p->args || p->type == CAO_NEXT) ?
 			      !strcmp(p->name, line) : strpfx(p->name, line))) {
-	    int l = strlen(p->name);
-	    if ((p->type == CAO_OEQUAL || p->type == CAO_EQUAL) &&
-		line[l] && line[l] != '=')
-		continue;
+		int l = strlen(p->name);
+		if ((p->type == CAO_OEQUAL || p->type == CAO_EQUAL) &&
+		    line[l] && line[l] != '=')
+		    continue;
 
 		if (end) {
 		    /* Return a pointer to the end of the option. */



Messages sorted by: Reverse Date, Date, Thread, Author