patchmake - Patches: patch #7240, cast const pointers to void* when...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #7240: cast const pointers to void* when feeding them to free(), qsort() or realloc()

Submitter:  Ozkan Sezer <sezero>
Submitted:  Thu 15 Jul 2010 12:33:25 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Fixed Release:  None

Mon 19 Jul 2010 03:33:32 AM UTC, comment #1: 

I added these casts, but I don't like it.  The MSVC compiler is broken, IMO, warning about this.  There's nothing wrong with passing a const** to these functions and this should not be a warning.  I really hate adding extra casts...

Paul D. Smith <psmith>
Group administrator
Thu 15 Jul 2010 12:33:25 PM UTC, original submission:  

Hi:

Const pointers need casting to void* when feeding them to free(), qsort() or realloc(), as in the attached patch.  Noticed this when compiling the CVS with MSVC. Tested by compiling for linux, win32 and win64 (mingw-w64, msvc 2208).

  • ar.c (ar_glob): Cast 'names' to void* i qsort() call.
  • main.c (decode_switches): Cast sl->list to void* in xrealloc call.

(clean_jobserver): Cast jobserver_fds->list to void* in free() call.

  • rule.c (freerule): Cast rule->targets and rule->suffixess to void* in free() calls.
  • vpath.c (construct_vpath_list): Cast path->searchpath and vpath to void* in free() and xrealloc() calls.


Ozkan Sezer <sezero>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #20981:  const.diff added by sezero (4KiB - application/octet-stream - const cast patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by sezero (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-19 psmith StatusNone Done
        Open/ClosedOpen Closed
    2010-07-15 sezero Attached File- Added const.diff, #20981

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code