[asterisk-dev] [Code Review] 4015: Get rid of most old libc free/malloc/realloc and replace with ast_free and friends.

wdoekes reviewboard at asterisk.org
Thu Sep 25 17:00:04 CDT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4015/
-----------------------------------------------------------

(Updated Sept. 25, 2014, 10 p.m.)


Review request for Asterisk Developers.


Changes
-------

(The /diff/2-3/ is buggy. I believe that's a known reviewboard issue.)

Addressed Richard comments:

- Rebased against trunk. You're absolute right, I forgot about the third-party modules.
- addons/chan_ooh-stuff now compiles.
- addons/mp3/interface.c now compiles if you run `contrib/scripts/get_mp3_source.sh` another time 
- main/tdd.c now compiles without MALLOC_DEBUG because of added include "asterisk/utils.h"

Also fixed:

- s/ast_free/jack_free/ in app_jack

Thanks for the review!


Bugs: ASTERISK-24348
    https://issues.asterisk.org/jira/browse/ASTERISK-24348


Repository: Asterisk


Description
-------

After having a bit of an issue with free() being defined as ast_free()
without it being obvious, as can be seen here
http://lists.digium.com/pipermail/asterisk-commits/2014-September/070353.html ,
I decided to abolish the use of free() (without ast_-prefix) wherever
reasonably possible.


The diff speaks for itself.

I added the define WRAP_LIBC_MALLOC to allow free() to mean ast_free()
and so on. See this:
https://reviewboard.asterisk.org/r/4015/diff/#28

If that is *not* defined, and "asterisk.h" is included, then free()
and friends will throw compile errors like this:

  mpool/mpool.c:291:3: error: implicit declaration of function
  ‘Do_not_use_free__use_ast_free_or_ast_std_free_for_remotely_allocated_memory’
  [-Werror=implicit-function-declaration]


That variable is defined for the cases where either STANDALONE
behaviour is expected (utils stuff) or code is autogenerated (lexer stuff).


Diffs (updated)
-----

  /trunk/utils/extconf.c 423893 
  /trunk/tests/test_dlinklists.c 423893 
  /trunk/res/res_smdi.c 423893 
  /trunk/res/res_rtp_asterisk.c 423893 
  /trunk/res/res_pktccops.c 423893 
  /trunk/res/res_phoneprov.c 423893 
  /trunk/res/res_config_ldap.c 423893 
  /trunk/res/ael/pval.c 423893 
  /trunk/res/ael/ael_lex.c 423893 
  /trunk/res/ael/ael.y 423893 
  /trunk/res/ael/ael.tab.c 423893 
  /trunk/res/ael/ael.flex 423893 
  /trunk/pbx/pbx_config.c 423893 
  /trunk/main/tdd.c 423893 
  /trunk/main/loader.c 423893 
  /trunk/main/hashtab.c 423893 
  /trunk/main/file.c 423893 
  /trunk/main/autoservice.c 423893 
  /trunk/main/ast_expr2f.c 423893 
  /trunk/main/ast_expr2.y 423893 
  /trunk/main/ast_expr2.c 423893 
  /trunk/main/app.c 423893 
  /trunk/main/acl.c 423893 
  /trunk/include/asterisk/astmm.h 423893 
  /trunk/funcs/func_curl.c 423893 
  /trunk/contrib/scripts/get_mp3_source.sh 423893 
  /trunk/channels/chan_skinny.c 423893 
  /trunk/channels/chan_mgcp.c 423893 
  /trunk/channels/chan_console.c 423893 
  /trunk/cel/cel_tds.c 423893 
  /trunk/apps/app_queue.c 423893 
  /trunk/apps/app_jack.c 423893 
  /trunk/addons/ooh323cDriver.c 423893 
  /trunk/addons/ooh323c/src/printHandler.c 423893 
  /trunk/addons/ooh323c/src/oochannels.c 423893 
  /trunk/addons/ooh323c/src/ooStackCmds.c 423893 
  /trunk/addons/ooh323c/src/ooCmdChannel.c 423893 
  /trunk/addons/ooh323c/src/ooCalls.c 423893 
  /trunk/addons/ooh323c/src/memheap.c 423893 
  /trunk/addons/ooh323c/src/errmgmt.c 423893 
  /trunk/addons/ooh323c/src/context.c 423893 
  /trunk/addons/chan_ooh323.c 423893 
  /trunk/addons/app_mysql.c 423893 

Diff: https://reviewboard.asterisk.org/r/4015/diff/


Testing
-------

It compiles.


Thanks,

wdoekes

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140925/00cd7254/attachment-0001.html>


More information about the asterisk-dev mailing list