Changeset 15 for vis_dev/glu-2.3/src
- Timestamp:
- Jul 13, 2011, 11:05:09 AM (13 years ago)
- Location:
- vis_dev/glu-2.3/src/array
- Files:
-
- 2 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 } -
vis_dev/glu-2.3/src/array/array.h
r13 r15 34 34 EXTERN int array_resize ARGS((array_t *, int)); 35 35 EXTERN char *array_do_data ARGS((array_t *)); 36 EXTERN array_t * array_partial_dup(array_t *old, int i); 36 37 37 38 extern int unsigned array_global_index;
Note: See TracChangeset
for help on using the changeset viewer.