Summary: | ASTERISK-20408: constify astobj2's __ao2_ref_debug parameters | ||
Reporter: | Matt Jordan (mjordan) | Labels: | |
Date Opened: | 2012-09-12 09:21:36 | Date Closed: | 2012-09-12 10:49:07 |
Priority: | Trivial | Regression? | No |
Status: | Closed/Complete | Components: | General |
Versions: | 1.8.15.1 10.7.1 10.7.1-digiumphones 11.0.0-beta1 | Frequency of Occurrence | |
Related Issues: | |||
Environment: | Attachments: | ||
Description: | In Asterisk 1.8, astobj2's __ao2_ref_debug has the following definition: {noformat} int __ao2_ref_debug(void *o, int delta, char *tag, char *file, int line, const char *funcname); {noformat} Because {{tag}} is not {{const}}, defining {{REF_DEBUG}} either in {{astobj2.h}} or in {{ccss.c}} results in the following warnings: {noformat} ccss.c:136:2: error: passing argument 3 of '__ao2_ref_debug' discards 'const' qualifier from pointer target type [-Werror] workspace/1.8/include/asterisk/astobj2.h:468:5: note: expected 'char *' but argument is of type 'const char *' ccss.c: In function 'cc_unref': ccss.c:142:2: error: passing argument 3 of '__ao2_ref_debug' discards 'const' qualifier from pointer target type [-Werror] workspace/1.8/include/asterisk/astobj2.h:468:5: note: expected 'char *' but argument is of type 'const char *' cc1: all warnings being treated as errors {noformat} {{ccss.c}} attempts to treat the {{tag}} as a {{const}} character string (which it probably should be): {noformat} static inline void *cc_ref(void *obj, const char *debug) { ao2_t_ref(obj, +1, debug); return obj; } static inline void *cc_unref(void *obj, const char *debug) { ao2_t_ref(obj, -1, debug); return NULL; } {noformat} There isn't any reason that I can think of to allow {{tag}} or {{file}} to be modified in {{astobj2}}. | ||
Comments: |