Troy D. Hanson 10 tahun lalu
induk
melakukan
90e6cce757
2 mengubah file dengan 3 tambahan dan 2 penghapusan
  1. 1 1
      opt/bundle/include/utvector.h
  2. 2 1
      opt/bundle/src/utvector.c

+ 1 - 1
opt/bundle/include/utvector.h

@@ -69,7 +69,7 @@ void *utvector_next(UT_vector *v, void *cur);
 void *utvector_pop(UT_vector *v);
 void *utvector_elt(UT_vector *v, unsigned i);
 void utvector_shift(UT_vector *v);
-void utvector_push(UT_vector *v, void *e);
+void *utvector_push(UT_vector *v, void *e);
 unsigned utvector_len(UT_vector *v);
 
 extern UT_vector_mm* utvector_int;

+ 2 - 1
opt/bundle/src/utvector.c

@@ -154,10 +154,11 @@ void utvector_shift(UT_vector *v) {
   else            memset(b, 0, v->mm.sz);
 }
 
-void utvector_push(UT_vector *v, void *e) {
+void *utvector_push(UT_vector *v, void *e) {
   void *b  = utvector_extend(v);
   if (v->mm.copy) v->mm.copy(b, e, 1);
   else            memcpy(b, e, v->mm.sz);
+  return v->d + ((v->i - 1) * v->mm.sz);
 }