ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/vector.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/vector.c (file contents):
Revision 1.3 by ats, Mon Apr 5 00:45:17 2004 UTC vs.
Revision 1.4 by ats, Mon Apr 5 00:58:05 2004 UTC

# Line 32 | Line 32
32   void *statgrab_vector_resize(void *vector, vector_header *h, int count) {
33          int new_count, i;
34  
35 <        /* Destroy any now-unused items. */
35 >        /* Destroy any now-unused items.
36 >         *
37 >         * Note that there's an assumption here that making the vector smaller
38 >         * will never fail; if it did, then we would have destroyed items here
39 >         * but not actually got rid of the vector pointing to them before the
40 >         * error return.) */
41          if (count < h->used_count && h->destroy_fn != NULL) {
42                  for (i = count; i < h->used_count; i++) {
43                          h->destroy_fn((void *) (vector + i * h->item_size));
# Line 51 | Line 56 | void *statgrab_vector_resize(void *vector, vector_head
56                  if (new_vector == NULL && new_count != 0) {
57                          /* Out of memory -- free the contents of the vector. */
58                          statgrab_vector_resize(vector, h, 0);
59 <                        /* And return the sentinel value to indicate failure. */
60 <                        return statgrab_vector_sentinel;
59 >                        h->error = -1;
60 >                        return vector;
61                  }
62  
63                  vector = new_vector;
# Line 67 | Line 72 | void *statgrab_vector_resize(void *vector, vector_head
72          }
73  
74          h->used_count = count;
75 <
75 >        h->error = 0;
76          return vector;
77   }
78  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines