Skip to content

Conversation

FrederikLauber
Copy link

Hi,

after looking at
palIntin.c: In function 'palIntin':
palIntin.c:132:17: warning: comparison between pointer and zero character constant [-Wpointer-compare]
132 | while ( ctemp != '\0' ) {
| ^~
palIntin.c:132:11: note: did you mean to dereference the pointer?
132 | while ( ctemp != '\0' ) {
| ^

I think this is wrong and should be while (*ctemp) to actually look for the end of the string.

On arch linux, this project did not compile due to 

  CC       libpal_la-palDfltin.lo
palDfltin.c: In function 'palDfltin':
palDfltin.c:185:3: error: implicit declaration of function 'strlcpy'; did you mean 'strncpy'? [-Wimplicit-function-declaration]
  185 |   strlcpy( tempbuf, &(string[*nstrt-1]), sizeof(tempbuf) );
      |   ^~~~~~~
      |   strncpy

After some debugging, the issue seems that HAVE_BSD_STRING_H was never set and thus the include never happens.
After looking at this compiler warning for some time:

palIntin.c: In function 'palIntin':
palIntin.c:132:17: warning: comparison between pointer and zero character constant [-Wpointer-compare]
  132 |   while ( ctemp != '\0' ) {
      |                 ^~
palIntin.c:132:11: note: did you mean to dereference the pointer?
  132 |   while ( ctemp != '\0' ) {
      |           ^


I think what people actually wanted to do is looking for the terminator of the string to not end up in a infinite loop.
However, ctemp is char * and thus needs to be de-referenced?
That code is 10 years old though so it is unclear to me how it could be wrong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant