Summary: | ASTERISK-02991: [patch] Make ast_test_flag and friends a macro | ||
Reporter: | Russell Bryant (russell) | Labels: | |
Date Opened: | 2004-12-14 22:47:43.000-0600 | Date Closed: | 2008-01-15 15:16:55.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) flagmacro.diff.txt | |
Description: | This little patch changes ast_test_flag and its friends to a macro and moves it from channel.h to utils.h. I wanted to use this to help trim down some of the other structs throughout asterisk. ****** ADDITIONAL INFORMATION ****** Disclaimer is on file | ||
Comments: | By: Mark Spencer (markster) 2004-12-14 22:54:47.000-0600 How about doing the rest of the flag test/set things too? By: Kevin P. Fleming (kpfleming) 2004-12-14 23:08:03.000-0600 Won't the compiler just treat the "static inline" functions as the equivalent of macros anyway, but with the distinct advantage of compile-time type checking? By: Mark Spencer (markster) 2004-12-14 23:12:55.000-0600 Well, the presumed purpose of converting to macro is exactly to eliminate the type checking so that it can be used with more than one structure (e.g. a sip_pvt, thus allowing us to condense the sip pvt structure by many many bytes). By: Kevin P. Fleming (kpfleming) 2004-12-14 23:15:06.000-0600 Ahh, right, I missed that. In other projects they declare a "flag holder" type (typedef for an int32 or something) and then the inline functions work off of that type. That means the calls would look something like: ast_set_flag(chan->flags, AST_FLAG_WRITE_INT) which is a little more verbose, but usable with as many structures as you want. By: Russell Bryant (russell) 2004-12-14 23:41:45.000-0600 I uploaded a new patch that changes all of those flag functions to macros. By: Mark Spencer (markster) 2004-12-15 22:18:44.000-0600 Fixed in CVS, thanks! By: Russell Bryant (russell) 2004-12-16 09:10:55.000-0600 not in 1.0 By: Digium Subversion (svnbot) 2008-01-15 15:16:55.000-0600 Repository: asterisk Revision: 4469 U trunk/apps/app_dial.c U trunk/channels/chan_agent.c U trunk/include/asterisk/channel.h U trunk/include/asterisk/utils.h U trunk/indications.c ------------------------------------------------------------------------ r4469 | markster | 2008-01-15 15:16:55 -0600 (Tue, 15 Jan 2008) | 2 lines Merge russell's flag macro patch (with slight mods) (bug ASTERISK-2991) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=4469 |