[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
Mon Sep 22 13:55:22 CDT 2014


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

Review request for Asterisk Developers.


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
-----

  /branches/1.8/utils/extconf.c 423656 
  /branches/1.8/tests/test_dlinklists.c 423656 
  /branches/1.8/res/res_smdi.c 423656 
  /branches/1.8/res/res_rtp_asterisk.c 423656 
  /branches/1.8/res/res_pktccops.c 423656 
  /branches/1.8/res/res_phoneprov.c 423656 
  /branches/1.8/res/res_config_ldap.c 423656 
  /branches/1.8/res/ais/evt.c 423656 
  /branches/1.8/res/ael/pval.c 423656 
  /branches/1.8/res/ael/ael_lex.c 423656 
  /branches/1.8/res/ael/ael.y 423656 
  /branches/1.8/res/ael/ael.tab.c 423656 
  /branches/1.8/res/ael/ael.flex 423656 
  /branches/1.8/pbx/pbx_config.c 423656 
  /branches/1.8/main/utils.c 423656 
  /branches/1.8/main/tdd.c 423656 
  /branches/1.8/main/loader.c 423656 
  /branches/1.8/main/hashtab.c 423656 
  /branches/1.8/main/file.c 423656 
  /branches/1.8/main/db1-ast/mpool/mpool.c 423656 
  /branches/1.8/main/channel.c 423656 
  /branches/1.8/main/autoservice.c 423656 
  /branches/1.8/main/ast_expr2f.c 423656 
  /branches/1.8/main/ast_expr2.y 423656 
  /branches/1.8/main/ast_expr2.c 423656 
  /branches/1.8/main/app.c 423656 
  /branches/1.8/main/acl.c 423656 
  /branches/1.8/include/asterisk/threadstorage.h 423656 
  /branches/1.8/include/asterisk/astmm.h 423656 
  /branches/1.8/funcs/func_curl.c 423656 
  /branches/1.8/channels/chan_skinny.c 423656 
  /branches/1.8/channels/chan_mgcp.c 423656 
  /branches/1.8/channels/chan_jingle.c 423656 
  /branches/1.8/channels/chan_gtalk.c 423656 
  /branches/1.8/channels/chan_console.c 423656 
  /branches/1.8/cel/cel_tds.c 423656 
  /branches/1.8/apps/app_stack.c 423656 
  /branches/1.8/apps/app_queue.c 423656 
  /branches/1.8/apps/app_jack.c 423656 
  /branches/1.8/addons/chan_ooh323.c 423656 
  /branches/1.8/addons/app_mysql.c 423656 

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/20140922/94557ace/attachment-0001.html>


More information about the asterisk-dev mailing list