Ticket #3856 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

comparison between pointer and zero character constant

Reported by: egmont Owned by:
Priority: major Milestone: 4.8.20
Component: mc-core Version: master
Keywords: Cc:
Blocked By: #3780 Blocking:
Branch state: no branch Votes for changeset:

Description

gcc-7.2 caught this:

  CC       boxes.lo
boxes.c: In function ‘jobs_fill_listbox’:
boxes.c:431:22: warning: comparison between pointer and zero character constant [-Wpointer-compare]
     if (state_str[0] == '\0')
                      ^~
boxes.c:431:9: note: did you mean to dereference the pointer?
     if (state_str[0] == '\0')
         ^

It's indeed right, the code is buggy. It should be state_str[0][0].

Attachments

mc-3856-pointer-vs-character-constant.patch (584 bytes) - added by egmont 7 years ago.

Change History

Changed 7 years ago by egmont

comment:1 Changed 7 years ago by egmont

... or maybe like this (see attached patch)?

(I haven't tried runtime, just compiled it :))

comment:2 Changed 7 years ago by andrew_b

  • Blocked By 3780 added

comment:3 Changed 7 years ago by andrew_b

This is already fixed in 3780_cleanup: b2bbd326e0aa77df8aa48b4a1b4fd25bbbb7a40a.

comment:4 Changed 7 years ago by egmont

  • Status changed from new to closed
  • Resolution set to fixed

Oops, sorry then :)

Note: See TracTickets for help on using tickets.