Hi Davy,

Davy Chan wrote:

> Statement:
>   We are now using -1 as the definition for an undefined value:
>     DLR_UNDEFINED = MSG_PARAM_UNDEFINED = SMS_PARAM_UNDEFINED =
>     MC_UNDEF = MWI_UNDEF = DC_UNDEF = COMPRESS_UNDEF = RPI_UNDEF
>     = -1

hmm, don't have code to check now but IIRC we have onl MSG_PARAM_UNDEFINED &
SMS_PARAM_UNDEFINED.
that was intentional so that MSG_PARAM_UNDEFINED may have another undefined
value as SMS_PARAM_UNDEFINED.

> 
> Problem:
>   1) Some of our code still has '-1' hardcoded instead of using the
>      symbolic XXX_UNDEF.

this should be fixed

>   2) Some places in the code have a comparison to '-1' to check for
>      an undefined value instead of using the symbolic XXX_UNDEF.

ditto

>   3) Some places in the code use a comparison to '-1' to check for
>      an undefined value because we did not specify a symbolic
>      name for an undefined value (usually return values from
>      the gwlib functions).

we should not define all undefined values as you write above. sms messages
should check against SMS_PARAM_UNDEFINED and global msg values (not sms
specific) against MSG_PARAM_UNDEFINED.

> 
> Proposed Remedy:
>   1) Add the definition:
>        #define IS_UNDEFINED -1
>      into gateway/gwlib/gwlib.h
>   2) Go through the code and change comparisions to '-1' into
>      comparisions to IS_UNDEFINED.
>   3) Go through the code and change assignments to '-1' to
>      assignments to the proper XXX_UNDEF for that variable.
> 
> I voluntee to do this if everyone feels this type of code cleanup
> is desired. (yeah, this is annoying the heck out of me while I'm coding
> my statusbox stuff).
> 
> See ya...
> 
> d.c.

-- 
Thanks,
Alex


Reply via email to