[asterisk-dev] any difference between NULL and "" in
struct ast_callerid fields ?
Julian Lyndon-Smith
asterisk at dotr.com
Fri Apr 21 04:09:01 MST 2006
FWIW, I would say that "<unknown>" is the best.
Julian.
Luigi Rizzo wrote:
> given the lack of feedback, I have started to fix the issues
> described below.
>
> As it is now, the code maps NULL or "" into three different values,
> not in a completely consistent way:
>
> ""
> "unknown"
> "<unknown>"
>
> what is the correct format ?
>
> luigi
>
> On Tue, Apr 18, 2006 at 09:50:59AM -0700, Luigi Rizzo wrote:
>> hi,
>> browsing throughout the code, i see that some places map
>> a NULL value in the struct ast_callerid fields to "<unknown>"
>> or similar string, but the empty string is left alone.
>>
>> However, i am not so sure that the behaviour is
>> consistent across the whole code, and especially,
>> i cannot see a reason why the empty string "" should
>> be treated differently from NULL.
>>
>> In many other places in asterisk, NULL and "" are considered the
>> same thing and we have plenty of utility functions code that assume
>> that.
>>
>> The reason is for this behaviour is an important one:
>>
>> we have both dynamically and statically allocated strings, and the
>> latter cannot store NULL and must represent it as an empty string.
>>
>> So, even if parts of the code that handle the CID fields
>> make use of the difference between NULL and "", there is a
>> huge risk that this difference is lost when passing values
>> around between different types of buffers.
>>
>> As a consequence, unless there are convincing explaination
>> on why we need to differentiate that, I am going to add
>> comments, in include/asterisk/channel.h, that in the ast_callerid
>> fields, NULL and "" are considered equivalent, and then start
>> making the code consistent with the above spec.
>>
>> comments welcome.
>>
>> cheers
>> luigi
>> _______________________________________________
>> --Bandwidth and Colocation provided by Easynews.com --
>>
>> asterisk-dev mailing list
>> To UNSUBSCRIBE or update options visit:
>> http://lists.digium.com/mailman/listinfo/asterisk-dev
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
>
More information about the asterisk-dev
mailing list