[Home]

Summary:ASTERISK-10740: [patch] Avoid including not needed header files or already included.
Reporter:Eliel Sardanons (eliel)Labels:
Date Opened:2007-11-12 11:55:19.000-0600Date Closed:2007-11-21 22:44:31.000-0600
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) include.patch
( 1) include2.patch
( 2) include3.patch
( 3) include4.patch
Description:This is only a code cleanup no "include <*.h>" was added their were only removed the ones that weren't needed because their weren't used or because their were included on another header.
Comments:By: Jason Parker (jparker) 2007-11-12 17:02:46.000-0600

We'll need to somehow verify that this still works with Solaris/FreeBSD/OSX.

They can be very...picky.

By: Jason Parker (jparker) 2007-11-12 17:06:01.000-0600

On Linux:

  [CC] dnsmgr.c -> dnsmgr.o
dnsmgr.c: In function ‘do_refresh’:
dnsmgr.c:204: warning: implicit declaration of function ‘usleep’
  [CC] http.c -> http.o
http.c: In function ‘static_callback’:
http.c:190: warning: implicit declaration of function ‘read’
http.c:193: warning: implicit declaration of function ‘close’
http.c: In function ‘ssl_setup’:
http.c:936: warning: implicit declaration of function ‘sleep’
  [CC] io.c -> io.o
io.c: In function ‘ast_hide_password’:
io.c:334: warning: implicit declaration of function ‘isatty’

By: snuffy (snuffy) 2007-11-12 18:07:26.000-0600

Same warnings for solaris
after adding unistd to those files was able to compile

By: Eliel Sardanons (eliel) 2007-11-12 19:29:38.000-0600

Sorry for those warning, I don't know why I didn't saw them while doing the patch.
Here is a new one adding the missing includes, against r89206

By: Eliel Sardanons (eliel) 2007-11-12 19:30:49.000-0600

I only tested this patch under linux.

By: Yuri (ys) 2007-11-13 02:30:25.000-0600

incude2.patch

FreeBSD 6.2:

gcc -o res_agi.o -c res_agi.c -D_THREAD_SAFE -pthread -I/usr/home/asterisk/src/asterisk/include  -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -include /usr/home/asterisk/src/asterisk/include/asterisk/autoconfig.h -I/usr/local/include -march=i386   -include /usr/home/asterisk/src/asterisk/include/asterisk/astmm.h -fPIC -DAST_MODULE=\"res_agi\"   -MMD -MT res_agi.o -MF .res_agi.o.d -MP
res_agi.c: In function `launch_netscript':
res_agi.c:173: warning: implicit declaration of function `socket'
res_agi.c:173: error: `AF_INET' undeclared (first use in this function)
res_agi.c:173: error: (Each undeclared identifier is reported only once
res_agi.c:173: error: for each function it appears in.)
res_agi.c:173: error: `SOCK_STREAM' undeclared (first use in this function)
res_agi.c:191: warning: implicit declaration of function `connect'
gmake[1]: *** [res_agi.o] Error 1
gmake: *** [res] Error 2

By: Eliel Sardanons (eliel) 2007-11-13 09:57:38.000-0600

Added include3.patch (r89240) to fix FreeBSD warnings.

By: Eliel Sardanons (eliel) 2007-11-13 13:16:38.000-0600

Added include4.patch (r89240) to fix many warnings on OpenBSD.
Thanks to mvanbaak for testing this patch against openbsd.

By: Yuri (ys) 2007-11-13 13:59:50.000-0600

include4.patch:
 compilation complete on FreeBSD 6.2 w/o critical error.

By: Eliel Sardanons (eliel) 2007-11-18 21:06:21.000-0600

I think rizzo is doing some commits related to this "issue". You could think about closing it.

By: Russell Bryant (russell) 2007-11-21 22:44:30.000-0600

I gave you a few karma points for all of the work you put into this.  :)

I think the work that rizzo has been doing has probably completely broken this patch.  Feel free to look at it some more once he slows down in that area.

Thanks again for your help!