IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 7, 2004, 2:09:06 PM (22 years ago)
Author:
desonia
Message:

converted files to new psError style (psErrorMsg). Removed any psAborts
from non-memory allocation code.

File:
1 edited

Legend:

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

    r1700 r1713  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-07 19:58:06 $
     11 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-08 00:09:06 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040#include "psString.h"
    4141#include "psError.h"
    42 #include "psAbort.h"
     42#include "psLogMsg.h"
     43
     44#include "psSysUtilsErrors.h"
     45#define ERRORNAME_PREFIX PS_ERRORNAME_DOMAIN ".psTrace."
    4346
    4447static p_psComponent* cRoot = NULL; // The root of the trace component
     
    107110    for (i = 0; i < currentNode->n; i++) {
    108111        if (NULL == currentNode->subcomp[i]) {
    109             psError(__func__,
    110                     "Sub-component %d of node %s in the trace tree is NULL.\n", i, currentNode->name);
     112            psLogMsg(ERRORNAME_PREFIX "p_psTraceReset", PS_LOG_WARN,
     113                     PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT,
     114                     i, currentNode->name);
    111115        } else {
    112116            p_psTraceReset(currentNode->subcomp[i]);
     
    131135to ANSI-C.
    132136 *****************************************************************************/
    133 static void componentAdd(const char *addNodeName, int level)
     137static bool componentAdd(const char *addNodeName, int level)
    134138{
    135139    int i = 0;                  // Loop index variable.
     
    142146    // XXX: Verify that this is the correct behavior.
    143147    if (strcmp("", addNodeName) == 0) {
    144         psAbort(__func__, "Failed to add null component to trace tree.\n");
     148        psErrorMsg(ERRORNAME_PREFIX "componentAdd",PS_ERR_BAD_PARAMETER_NULL,true,
     149                   PS_ERRORTEXT_psTrace_ADD_NULL_COMPONENT);
     150        return false;
    145151    }
    146152
     
    148154    if (strcmp(".", addNodeName) == 0) {
    149155        cRoot->level = level;
    150         return;
     156        return true;
    151157    }
    152158
    153159    if (addNodeName[0] != '.') {
    154         psAbort(__func__,"Failed to add %s to the root component tree.\n",
    155                 addNodeName);
     160        psErrorMsg(ERRORNAME_PREFIX "componentAdd",PS_ERR_BAD_PARAMETER_VALUE,true,
     161                   PS_ERRORTEXT_psTrace_MALFORMED_COMPONENT_NAME,
     162                   addNodeName);
     163        return false;
    156164    }
    157165
     
    188196        }
    189197    }
     198
     199    return true;
    190200}
    191201
     
    201211 zero
    202212*****************************************************************************/
    203 int psTraceSetLevel(const char *comp,   // component of interest
    204                     int level)  // desired trace level
     213bool psTraceSetLevel(const char *comp,   // component of interest
     214                     int level)  // desired trace level
    205215{
    206216    // If the root component tree does not exist, then initialize it.
     
    209219    }
    210220    // Add the new component to the component tree.
    211     componentAdd(comp, level);
    212 
     221    if ( !componentAdd(comp, level) ) {
     222        psErrorMsg(ERRORNAME_PREFIX "psTraceSetLevel", PS_ERR_UNKNOWN, false,
     223                   PS_ERRORTEXT_psTrace_FAILED_TO_ADD_COMPONENT,level,comp);
     224        return false;
     225    }
    213226    // return 0 on success.
    214     return 0;
     227    return true;
    215228}
    216229
     
    255268        for (i = 0; i < currentNode->n; i++) {
    256269            if (NULL == currentNode->subcomp[i]) {
    257                 psError(__func__,
    258                         "Sub-component %d of node %s in trace tree is NULL.\n", i, currentNode->name);
     270                psLogMsg(ERRORNAME_PREFIX "p_psTraceReset", PS_LOG_WARN,
     271                         PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT,
     272                         i, currentNode->name);
    259273            }
    260274
     
    365379
    366380    if (NULL == comp) {
    367         psError(__func__, "p_psTrace() called on a NULL trace level tree\n");
     381        psErrorMsg(ERRORNAME_PREFIX "psTrace", PS_ERR_BAD_PARAMETER_NULL, true,
     382                   PS_ERRORTEXT_psTrace_NULL_TRACETREE,
     383                   __func__);
     384        return;
    368385    }
    369386    // Only display this message if it's trace level is less than the level
Note: See TracChangeset for help on using the changeset viewer.