IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12286


Ignore:
Timestamp:
Mar 6, 2007, 2:17:48 PM (19 years ago)
Author:
Paul Price
Message:

Changing assertions to be more suitable.

Location:
trunk/psLib/src/sys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psString.c

    r11711 r12286  
    1313 *  @author David Robbins, MHPCC
    1414 *
    15  *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2007-02-08 22:27:30 $
     15 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2007-03-07 00:17:48 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8787                         unsigned int nChar)
    8888{
    89     PS_ASSERT_PTR_NON_NULL(string, NULL);
    90 
    9189    // Pass through NULL values
    9290    if (!string) {
     
    123121{
    124122    PS_ASSERT_PTR_NON_NULL(dest, 0);
    125     PS_ASSERT_PTR_NON_NULL(format, 0);
     123    PS_ASSERT_STRING_NON_EMPTY(format, 0);
    126124
    127125    va_list ap;
     
    141139{
    142140    PS_ASSERT_PTR_NON_NULL(dest, 0);
    143     PS_ASSERT_PTR_NON_NULL(format, 0);
     141    PS_ASSERT_STRING_NON_EMPTY(format, 0);
    144142
    145143    size_t          length = 0;             // complete string length (sans \0)
     
    194192{
    195193    PS_ASSERT_PTR_NON_NULL(dest, 0);
    196     PS_ASSERT_PTR_NON_NULL(format, 0);
     194    PS_ASSERT_STRING_NON_EMPTY(format, 0);
    197195
    198196    va_list ap;
     
    213211{
    214212    PS_ASSERT_PTR_NON_NULL(dest, 0);
    215     PS_ASSERT_PTR_NON_NULL(format, 0);
     213    PS_ASSERT_STRING_NON_EMPTY(format, 0);
    216214
    217215    size_t          length;             // complete string length (sans \0)
     
    275273                      bool multipleAreSignificant)
    276274{
    277     PS_ASSERT_PTR_NON_NULL(splitters, NULL);
     275    PS_ASSERT_STRING_NON_EMPTY(splitters, NULL);
    278276
    279277    psList *values = psListAlloc(NULL); // The list of values to return
  • trunk/psLib/src/sys/psTrace.c

    r11674 r12286  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.85 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2007-02-07 01:15:49 $
     11 *  @version $Revision: 1.86 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2007-03-07 00:17:48 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2222 might give that a numerically low trace level, such as 1, so then any
    2323 non-zero trace level in that code component will display thatmessage.
    24  
     24
    2525 We build a tree of trace components.  Every node in the tree has a
    2626 depth, which is it's distance from the root.  However, this is not
    2727 not the same thing as a node's "level", which corresponds to the
    2828 trace level of that node.
    29  
     29
    3030I think the following is the correct behavior, but not sure:
    3131    PS_UNKNOWN_TRACE_LEVEL: We never set the level of a component to this
    3232    value.  This value is only used when psTraceGetLevel is called with
    3333    a bad component name, or if the component root is undefined, I think.
    34  
     34
    3535    PS_DEFAULT_TRACE_LEVEL: This should only be used when adding the
    3636    intermediate components of a psS64 name.  Ie. the "B" in .A.B.C
    37  
     37
    3838 *****************************************************************************/
    3939
     
    134134// NB: declares TARGET!
    135135#define FACILITY(TARGET, FUNC, FACIL) \
    136 size_t _facilLength = strlen(FACIL); /* Length of facility name */ \
    137 size_t _funcLength = strlen(FUNC);   /* Length of function name */ \
    138 char TARGET[_facilLength + _funcLength + 2]; /* facility + the function name */ \
    139 strcpy(&TARGET[0], FACIL); \
    140 TARGET[_facilLength] = '.'; \
    141 strcpy(&TARGET[_facilLength + 1], FUNC);
     136    size_t _facilLength = strlen(FACIL); /* Length of facility name */ \
     137    size_t _funcLength = strlen(FUNC);   /* Length of function name */ \
     138    char TARGET[_facilLength + _funcLength + 2]; /* facility + the function name */ \
     139    strcpy(&TARGET[0], FACIL); \
     140    TARGET[_facilLength] = '.'; \
     141    strcpy(&TARGET[_facilLength + 1], FUNC);
    142142
    143143
    144144/*****************************************************************************
    145145Set all trace levels to zero.
    146  
     146
    147147XXX: Currently, no function calls this routine.
    148148 *****************************************************************************/
     
    267267    psSetTraceLevel(): add the component named "comp" to the component tree,
    268268 if it is not already there, and set it's trace level to "level".
    269  
     269
    270270    NOTE: We modified this so that the user may omit the leading "," in a
    271271    component name.  Since the code was already implemented assuming the "."
    272272    was required, rather than change all that code, in this function, I
    273273    simply add a leading "." to the component name if there is none.
    274  
     274
    275275    Input:
    276276 comp
     
    284284                    int level)  // desired trace level
    285285{
    286     PS_ASSERT_PTR_NON_NULL(comp, 0);
     286    PS_ASSERT_STRING_NON_EMPTY(comp, 0);
    287287
    288288    char *compName = NULL;
     
    331331 finds that component, it returns the level of that component.
    332332 Otherwise, it returns ???.
    333  
     333
    334334    NOTE: We modified this so that the user may omit the leading "," in a
    335335    component name.  Since the code was already implemented assuming the "."
    336336    was required, rather than change all that code, in this function, I
    337337    simply add a leading "." to the component name if there is none.
    338  
     338
    339339    Inputs:
    340340 name:
     
    449449                      const char *name)
    450450{
    451     PS_ASSERT_PTR_NON_NULL(name, 0);
    452     PS_ASSERT_PTR_NON_NULL(func, 0);
     451    PS_ASSERT_STRING_NON_EMPTY(name, 0);
     452    PS_ASSERT_STRING_NON_EMPTY(func, 0);
    453453
    454454    FACILITY(facility, func, name);
     
    527527              va_list ap)
    528528{
    529     PS_ASSERT_PTR_NON_NULL(comp, );
    530     PS_ASSERT_PTR_NON_NULL(format, );
     529    PS_ASSERT_STRING_NON_EMPTY(comp, );
     530    PS_ASSERT_STRING_NON_EMPTY(format, );
    531531
    532532    // XXX EAM : fd < 1 does not print messages
     
    660660)
    661661{
    662     PS_ASSERT_PTR_NON_NULL(file, );
    663     PS_ASSERT_PTR_NON_NULL(func, );
    664     PS_ASSERT_PTR_NON_NULL(facil, );
    665     PS_ASSERT_PTR_NON_NULL(format, );
     662    PS_ASSERT_STRING_NON_EMPTY(file, );
     663    PS_ASSERT_STRING_NON_EMPTY(func, );
     664    PS_ASSERT_STRING_NON_EMPTY(facil, );
     665    PS_ASSERT_STRING_NON_EMPTY(format, );
    666666
    667667    FACILITY(name, func, facil);
     
    698698    included in message traces.  It does not determine the order in which that
    699699    information will appear (that order is fixed).
    700  
     700
    701701Input:
    702702    fmt: a string specifying the format.
Note: See TracChangeset for help on using the changeset viewer.