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

Re: [PATCH 1/6] fix implicit typecast for strict compilers




On 06/07/2014 09:04 PM, Bart Schaefer wrote:
On Jun 7,  7:18pm, Nikolas Garofil wrote:
}
} diff --git a/Src/compat.c b/Src/compat.c
} index cc4e876..81a95d5 100644
} --- a/Src/compat.c
} +++ b/Src/compat.c
} @@ -40,7 +40,7 @@ strstr(const char *s, const char *t)
}      char *p1, *p2;
}
}      for (; *s; s++) {
} -        for (p1 = s, p2 = t; *p2; p1++, p2++)
} +        for (p1 = (char*)s, p2 = (char*)t; *p2; p1++, p2++)
}              if (*p1 != *p2)
}                  break;
}          if (!*p2)
} --


Wouldn't the right thing here be to declare

	const char *p1, *p2;

instead of casting?


The p1 and p2 pointers are increased at the end of the line to walk through the string so that wouldn't work



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