[Asterisk-code-review] Sorcery: Create human friendly serializer names. (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Fri Jan 8 15:55:11 CST 2016


Richard Mudgett has posted comments on this change.

Change subject: Sorcery: Create human friendly serializer names.
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.asterisk.org/#/c/1957/1/main/sorcery.c
File main/sorcery.c:

Line 860: 	/* Create name with seq number appended.  Truncate type to ensure string fits. */
        : 	snprintf(seq, sizeof(seq), "-%08x", ast_taskprocessor_seq_num());
        : 	snprintf(tps_name, sizeof(tps_name) - sizeof(seq) + 1, "sorcery/%s", type);
        : 	strcat(tps_name, seq);
> I've noticed that in this and other reviews, the creators of the taskproces
The sequence number is not a requirement for taskprocessor names.  The names just have to be unique from any other taskprocessor name in the system.  For taskprocessors such as "CCSS_core" or "app_voicemail" there is no need for a sequence number because the respective modules will only create one.  It is the creator's responsibility to come up with unique names for its taskprocessors.  Only the creator knows if it is creating only one or a series of taskprocessors.  The new ast_taskprocessor_seq_num() API call is just a convenience to supply a serialized value to put in the creator's taskprocessor name.

After all the above, I've come up with an idea to package the above lines in a convenience function to build the name string from a user supplied printf format string.

FYI: The AST_TASKPROCESSOR_MAX_NAME value is a suggested maximum length.  Creating a name longer than that will only distort the 'core show taskprocessors' output.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idc2e5d3dbab15c825b97c38c028319a0d2315c47
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list