IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4135


Ignore:
Timestamp:
Jun 7, 2005, 12:36:48 PM (21 years ago)
Author:
gusciora
Message:

Standarized the PS_ASSERTs for checking pointers.

Location:
trunk/psLib/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psHash.c

    r3769 r4135  
    99*
    1010*  @author Robert Lupton, Princeton University
    11 *  @author George Gusciora, MHPCC
    1211*  @author Robert DeSonia, MHPCC
     12*  @author GLG, MHPCC
    1313*
    14 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2005-04-26 19:53:30 $
     14*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2005-06-07 22:36:48 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    346346                 psPtr data)
    347347{
    348     if (table == NULL) {
    349         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    350                 PS_ERRORTEXT_psHash_TABLE_NULL);
    351         return false;
    352     }
    353     if (key == NULL) {
    354         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    355                 PS_ERRORTEXT_psHash_KEY_NULL);
    356         return false;
    357     }
    358     if (data == NULL) {
    359         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    360                 PS_ERRORTEXT_psHash_DATA_NULL);
    361         return false;
    362     }
     348    PS_ASSERT_PTR_NON_NULL(table, false);
     349    PS_ASSERT_PTR_NON_NULL(key, false);
     350    PS_ASSERT_PTR_NON_NULL(data, false);
    363351
    364352    return (doHashWork(table, key, data, false) != NULL);
     
    379367                   const char *key)     // key to lookup
    380368{
    381     if (table == NULL) {
    382         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    383                 PS_ERRORTEXT_psHash_TABLE_NULL);
    384         return NULL;
    385     }
    386     if (key == NULL) {
    387         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    388                 PS_ERRORTEXT_psHash_KEY_NULL);
    389         return NULL;
    390     }
     369    PS_ASSERT_PTR_NON_NULL(table, false);
     370    PS_ASSERT_PTR_NON_NULL(key, false);
    391371
    392372    return doHashWork(table, key, NULL, false);
     
    408388    psBool retVal = false;
    409389
    410     if (table == NULL) {
    411         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    412                 PS_ERRORTEXT_psHash_TABLE_NULL);
    413         return false;
    414     }
    415     if (key == NULL) {
    416         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    417                 PS_ERRORTEXT_psHash_KEY_NULL);
    418         return false;
    419     }
     390    PS_ASSERT_PTR_NON_NULL(table, false);
     391    PS_ASSERT_PTR_NON_NULL(key, false);
    420392
    421393    data = doHashWork(table, key, NULL, true);
     
    431403psArray* psHashToArray(psHash* table)
    432404{
    433 
    434     if (table == NULL) {
    435         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    436                 PS_ERRORTEXT_psHash_TABLE_NULL);
    437         return NULL;
    438     }
     405    PS_ASSERT_PTR_NON_NULL(table, NULL);
    439406
    440407    // first, let's just count the number of data elements to know what size
  • trunk/psLib/src/collections/psHash.h

    r3264 r4135  
    1 
    21/** @file  psHash.h
    32 *  @brief Contains support for basic hashing functions.
     
    98 *
    109 *  @author Robert Lupton, Princeton University
    11  *  @author George Gusciora, MHPCC
    1210 *  @author Robert DeSonia, MHPCC
     11 *  @author GLG, MHPCC
    1312 *
    14  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-02-17 19:26:23 $
     13 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-07 22:36:48 $
    1615 *
    1716 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2928typedef struct psHashBucket
    3029{
    31     char *key;                         ///< key for this item of data
    32     psPtr data;                        ///< the data itself
    33     struct psHashBucket* next;         ///< list of other possible keys
     30    char *key;                         ///< The key for this item of data.
     31    psPtr data;                        ///< The data itself.
     32    struct psHashBucket* next;         ///< The list of other possible keys.
    3433}
    3534psHashBucket;
     
    5251/// Insert entry into table.
    5352psBool psHashAdd(
    54     psHash* table,                 ///< table to insert in
    55     const char *key,               ///< key to use
    56     psPtr data                     ///< data to insert
     53    psHash* table,                 ///< The table to insert in.
     54    const char *key,               ///< The key to use.
     55    psPtr data                     ///< The data to insert.
    5756);
    5857
    5958/// Lookup key in table.
    6059psPtr psHashLookup(
    61     psHash* table,                 ///< table to lookup key in
    62     const char *key                ///< key to lookup
     60    psHash* table,                 ///< The table to lookup key in.
     61    const char *key                ///< The key to lookup.
    6362);
    6463
    6564/// Remove key from table.
    6665psBool psHashRemove(
    67     psHash* table,                 ///< table to lookup key in
    68     const char *key                ///< key to lookup
     66    psHash* table,                 ///< The table to lookup key in.
     67    const char *key                ///< The key to lookup.
    6968);
    7069
    7170/// List all keys in table.
    7271psList* psHashKeyList(
    73     psHash* table                  ///< table to list keys from.
     72    psHash* table                  ///< The table to list keys from..
    7473);
    7574
     
    7978 */
    8079psArray* psHashToArray(
    81     psHash* table                  ///< table to convert to psArray
     80    psHash* table                  ///< The table to convert to psArray.
    8281);
    8382
  • trunk/psLib/src/types/psHash.c

    r3769 r4135  
    99*
    1010*  @author Robert Lupton, Princeton University
    11 *  @author George Gusciora, MHPCC
    1211*  @author Robert DeSonia, MHPCC
     12*  @author GLG, MHPCC
    1313*
    14 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2005-04-26 19:53:30 $
     14*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2005-06-07 22:36:48 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    346346                 psPtr data)
    347347{
    348     if (table == NULL) {
    349         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    350                 PS_ERRORTEXT_psHash_TABLE_NULL);
    351         return false;
    352     }
    353     if (key == NULL) {
    354         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    355                 PS_ERRORTEXT_psHash_KEY_NULL);
    356         return false;
    357     }
    358     if (data == NULL) {
    359         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    360                 PS_ERRORTEXT_psHash_DATA_NULL);
    361         return false;
    362     }
     348    PS_ASSERT_PTR_NON_NULL(table, false);
     349    PS_ASSERT_PTR_NON_NULL(key, false);
     350    PS_ASSERT_PTR_NON_NULL(data, false);
    363351
    364352    return (doHashWork(table, key, data, false) != NULL);
     
    379367                   const char *key)     // key to lookup
    380368{
    381     if (table == NULL) {
    382         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    383                 PS_ERRORTEXT_psHash_TABLE_NULL);
    384         return NULL;
    385     }
    386     if (key == NULL) {
    387         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    388                 PS_ERRORTEXT_psHash_KEY_NULL);
    389         return NULL;
    390     }
     369    PS_ASSERT_PTR_NON_NULL(table, false);
     370    PS_ASSERT_PTR_NON_NULL(key, false);
    391371
    392372    return doHashWork(table, key, NULL, false);
     
    408388    psBool retVal = false;
    409389
    410     if (table == NULL) {
    411         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    412                 PS_ERRORTEXT_psHash_TABLE_NULL);
    413         return false;
    414     }
    415     if (key == NULL) {
    416         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    417                 PS_ERRORTEXT_psHash_KEY_NULL);
    418         return false;
    419     }
     390    PS_ASSERT_PTR_NON_NULL(table, false);
     391    PS_ASSERT_PTR_NON_NULL(key, false);
    420392
    421393    data = doHashWork(table, key, NULL, true);
     
    431403psArray* psHashToArray(psHash* table)
    432404{
    433 
    434     if (table == NULL) {
    435         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    436                 PS_ERRORTEXT_psHash_TABLE_NULL);
    437         return NULL;
    438     }
     405    PS_ASSERT_PTR_NON_NULL(table, NULL);
    439406
    440407    // first, let's just count the number of data elements to know what size
  • trunk/psLib/src/types/psHash.h

    r3264 r4135  
    1 
    21/** @file  psHash.h
    32 *  @brief Contains support for basic hashing functions.
     
    98 *
    109 *  @author Robert Lupton, Princeton University
    11  *  @author George Gusciora, MHPCC
    1210 *  @author Robert DeSonia, MHPCC
     11 *  @author GLG, MHPCC
    1312 *
    14  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-02-17 19:26:23 $
     13 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-07 22:36:48 $
    1615 *
    1716 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2928typedef struct psHashBucket
    3029{
    31     char *key;                         ///< key for this item of data
    32     psPtr data;                        ///< the data itself
    33     struct psHashBucket* next;         ///< list of other possible keys
     30    char *key;                         ///< The key for this item of data.
     31    psPtr data;                        ///< The data itself.
     32    struct psHashBucket* next;         ///< The list of other possible keys.
    3433}
    3534psHashBucket;
     
    5251/// Insert entry into table.
    5352psBool psHashAdd(
    54     psHash* table,                 ///< table to insert in
    55     const char *key,               ///< key to use
    56     psPtr data                     ///< data to insert
     53    psHash* table,                 ///< The table to insert in.
     54    const char *key,               ///< The key to use.
     55    psPtr data                     ///< The data to insert.
    5756);
    5857
    5958/// Lookup key in table.
    6059psPtr psHashLookup(
    61     psHash* table,                 ///< table to lookup key in
    62     const char *key                ///< key to lookup
     60    psHash* table,                 ///< The table to lookup key in.
     61    const char *key                ///< The key to lookup.
    6362);
    6463
    6564/// Remove key from table.
    6665psBool psHashRemove(
    67     psHash* table,                 ///< table to lookup key in
    68     const char *key                ///< key to lookup
     66    psHash* table,                 ///< The table to lookup key in.
     67    const char *key                ///< The key to lookup.
    6968);
    7069
    7170/// List all keys in table.
    7271psList* psHashKeyList(
    73     psHash* table                  ///< table to list keys from.
     72    psHash* table                  ///< The table to list keys from..
    7473);
    7574
     
    7978 */
    8079psArray* psHashToArray(
    81     psHash* table                  ///< table to convert to psArray
     80    psHash* table                  ///< The table to convert to psArray.
    8281);
    8382
Note: See TracChangeset for help on using the changeset viewer.