[Asterisk-code-review] stringfields: Refactor to allow fields to be added to the e... (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Mon Apr 4 11:33:04 CDT 2016


Richard Mudgett has posted comments on this change.

Change subject: stringfields:  Refactor to allow fields to be added to the end of structures
......................................................................


Patch Set 6: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/2477/6/include/asterisk/stringfields.h
File include/asterisk/stringfields.h:

PS6, Line 230: 	/*!
             : 	 * If ast_calloc_with_stringfields was used to create the string fields, the following fields
             : 	 * contain the metadata used to allocate the memory.
             : 	 */
             : 	int num_structs; /*! The number of structures requested */
             : 	int index;       /*! The index of this structure in the allocation */
             : 	size_t size;     /*! The final size of each structure */
You need an object with three or more stringfields to start making the memory pool overhead worth it.  This patch increases it slightly but the external stringfield support is worth it to allow adding new members without breaking ABI compatibility.

However, I'm thinking we should abandon ast_calloc_with_stringfields() supporting multi-object arrays and go back to just asserting if num_structs != 1.  The overhead per object with stringfields is getting excessive for a feature that isn't really used/needed.


-- 
To view, visit https://gerrit.asterisk.org/2477
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I235db338c5b178f5a13b7946afbaa5d4a0f91d61
Gerrit-PatchSet: 6
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list