/[pspp]/pspp/src/algorithm.c
ViewVC logotype

Diff of /pspp/src/algorithm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by blp, Tue Nov 16 08:08:00 2004 UTC revision 1.13 by blp, Tue Mar 15 06:04:10 2005 UTC
# Line 365  copy_if (const void *array, size_t count Line 365  copy_if (const void *array, size_t count
365    return nonzero_cnt;    return nonzero_cnt;
366  }  }
367    
368    /* Removes N elements starting at IDX from ARRAY, which consists
369       of COUNT elements of SIZE bytes each, by shifting the elements
370       following them, if any, into its position. */
371    void
372    remove_range (void *array_, size_t count, size_t size,
373                  size_t idx, size_t n)
374    {
375      char *array = array_;
376      
377      assert (array != NULL);
378      assert (idx <= count);
379      assert (idx + n <= count);
380    
381      if (idx + n < count)
382        memmove (array + idx * size, array + (idx + n) * size,
383                 size * (count - idx - n));
384    }
385    
386    /* Removes element IDX from ARRAY, which consists of COUNT
387       elements of SIZE bytes each, by shifting the elements
388       following it, if any, into its position. */
389    void
390    remove_element (void *array, size_t count, size_t size,
391                    size_t idx)
392    {
393      remove_range (array, count, size, idx, 1);
394    }
395    
396  /* A predicate and its auxiliary data. */  /* A predicate and its auxiliary data. */
397  struct pred_aux  struct pred_aux
398    {    {

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26