Changeset 15 for vis_dev/glu-2.3/src/array/array.c
- Timestamp:
- Jul 13, 2011, 11:05:09 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vis_dev/glu-2.3/src/array/array.c
r13 r15 65 65 } 66 66 (void) memcpy(newa->space, old->space, old->num * old->obj_size); 67 return newa; 68 } 69 70 array_t * 71 array_partial_dup(array_t *old, int i) 72 { 73 array_t *newa; 74 75 newa = ALLOC(array_t, 1); 76 if (newa == NIL(array_t)) { 77 return NIL(array_t); 78 } 79 newa->num = old->num - 1; 80 newa->n_size = old->num - 1; 81 newa->obj_size = old->obj_size; 82 newa->index = -newa->obj_size; 83 newa->space = ALLOC(char, newa->n_size * newa->obj_size); 84 if (newa->space == NIL(char)) { 85 FREE(newa); 86 return NIL(array_t); 87 } 88 if (i > 0) 89 (void) memcpy(newa->space, old->space, i * old->obj_size); 90 if (i < old->num - 1) 91 (void) memcpy(newa->space + ((i) * old->obj_size), 92 old->space + ((i+1) * old->obj_size), (old->num - (i + 1)) * old->obj_size); 67 93 return newa; 68 94 }
Note: See TracChangeset
for help on using the changeset viewer.