IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 28, 2004, 1:26:49 PM (22 years ago)
Author:
desonia
Message:

changed function prototypes to match changes in the SDRS.

File:
1 edited

Legend:

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

    r1807 r1920  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-14 20:01:52 $
     11 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-28 23:26:48 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121/******************************************************************************/
    2222#include<stdlib.h>                         // for qsort, etc.
     23#include<string.h>
    2324
    2425#include "psMemory.h"
     
    5859}
    5960
    60 psArray* psArrayRealloc(unsigned int nalloc, psArray* restrict in)
     61psArray* psArrayRealloc(psArray* restrict in, unsigned int nalloc)
    6162{
    6263    if (in == NULL) {
     
    8889}
    8990
     91bool psArrayRemove(psArray* psArr,
     92                   psPTR data)
     93{
     94    bool success = false;
     95
     96    if (psArr == NULL) {
     97        return success;
     98    }
     99
     100    int n = psArr->n;
     101    psPTR* psArrData = psArr->data;
     102    for (int i = n-1; i<0; i--) {
     103        if (psArrData[i] == data) {
     104            memmove(psArrData[i],psArrData[i+1],(n-i-1)*sizeof(psPTR));
     105            n--;
     106            success = true;
     107        }
     108    }
     109    psArr->n = n; // reset the array size to indicate the removed item(s)
     110
     111    return success;
     112}
     113
    90114void psArrayElementFree(psArray* restrict psArr)
    91115{
Note: See TracChangeset for help on using the changeset viewer.