vgmrips / vgmplay-legacy

VGM file command-line player and Winamp plugin.
http://vgmrips.net
224 stars 54 forks source link

Fix proposal for malloc.h, wchar.h #21

Closed cecton closed 8 years ago

cecton commented 8 years ago

Hello,

I would like to make a PR to fix some issues but, since I'm not an expert in C, I would like to know if my solutions work for you (but maybe you don't mind since you've planned to re-write it all anyway...)

  1. For OSX I got to replace all the #include <malloc.h> by #include <sys/malloc.h>. Is it okay if I fix it with a conditional #ifdef MACOSX?
  2. With some compiler (clang) I got to add #include <wchar.h> in Stream.c. Is it okay if I simply add this include in Stream.c? It works normally in gcc.

Thanks

ValleyBell commented 8 years ago

I planned to remove memory.h/malloc.h from VGMPlay during a rewrite, actually. The optimal solution is: memory.h -> string.h, malloc.h -> stdlib.h Then you don't need any #ifdef. (All functions of memory.h/malloc.h are already part of stdlib.h/string.h. Using the former ones was just a bad habit of mine.)

Feel free to add wchar.h.

cecton commented 8 years ago

Okay for the wchar.h.

About the malloc.h I already have the solution with the ifdef. Do you plan to rewrite it entirely? Then I guess it's okay to apply my fix as a temporary fix for OSX users. What do you think?

superctr commented 8 years ago

Well you don't really need the extra #ifdef, since the whole malloc.h include is redundant, you can just get rid of it and use stdlib.h

On Wed, Mar 23, 2016 at 5:24 PM, Cecile Tonglet notifications@github.com wrote:

Okay for the wchar.h.

About the malloc.h I already have the solution with the ifdef. Do you plan to rewrite it entirely? Then I guess it's okay to apply my fix as a temporary fix for OSX users. What do you think?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/vgmrips/vgmplay/issues/21#issuecomment-200421750

ValleyBell commented 8 years ago

Sorry, I've not been clear. Instead of adding #ifdefs, just replace malloc.h with stdlib.h. That's a clean solution and makes the code more portable.

(I wanted to rewrite VGMPlay someday and fix such issues, which is why I haven't fixed it here. But I didn't get too far yet.)

cecton commented 8 years ago

Okay I get it :) I'll do that.