summaryrefslogtreecommitdiffstats
path: root/src/lib/rpc/dyn.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/rpc/dyn.c')
-rw-r--r--src/lib/rpc/dyn.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/lib/rpc/dyn.c b/src/lib/rpc/dyn.c
index 192095cbc9..bce1fd2a7d 100644
--- a/src/lib/rpc/dyn.c
+++ b/src/lib/rpc/dyn.c
@@ -81,7 +81,7 @@ DynObjectP DynCopy(obj)
DynObjectP obj;
{
DynObjectP obj1;
-
+
obj1 = (DynObjectP) malloc(sizeof(DynObjectRecP));
if (obj1 == NULL)
return NULL;
@@ -98,7 +98,7 @@ DynObjectP DynCopy(obj)
free(obj1);
return NULL;
}
- memcpy(obj1->array, obj->array,
+ memcpy(obj1->array, obj->array,
(size_t) (obj1->el_size * obj1->size));
return obj1;
@@ -154,7 +154,7 @@ int DynDebug(obj, state)
/*
* Checkers! Get away from that "hard disk erase" button!
* (Stupid dog. He almost did it to me again ...)
- */
+ */
int DynDelete(obj, idx)
DynObjectP obj;
int idx;
@@ -164,7 +164,7 @@ int DynDelete(obj, idx)
fprintf(stderr, "dyn: delete: bad index %d\n", idx);
return DYN_BADINDEX;
}
-
+
if (idx >= obj->num_el) {
if (obj->debug)
fprintf(stderr, "dyn: delete: Highest index is %d.\n",
@@ -182,14 +182,14 @@ int DynDelete(obj, idx)
if (obj->debug)
fprintf(stderr, "dyn: delete: last element, punting.\n");
}
- }
+ }
else {
if (obj->debug)
fprintf(stderr,
"dyn: delete: copying %d bytes from %p + %d to + %d.\n",
obj->el_size*(obj->num_el - idx), obj->array,
(idx+1)*obj->el_size, idx*obj->el_size);
-
+
memmove(obj->array + idx*obj->el_size,
obj->array + (idx+1)*obj->el_size,
(size_t) obj->el_size*(obj->num_el - idx));
@@ -203,9 +203,9 @@ int DynDelete(obj, idx)
(size_t) obj->el_size);
}
}
-
+
--obj->num_el;
-
+
if (obj->debug)
fprintf(stderr, "dyn: delete: done.\n");
@@ -244,7 +244,7 @@ int DynInsert(obj, idx, els_in, num)
{
DynPtr els = (DynPtr) els_in;
int ret;
-
+
if (idx < 0 || idx > obj->num_el) {
if (obj->debug)
fprintf(stderr, "dyn: insert: index %d is not in [0,%d]\n",
@@ -327,18 +327,18 @@ DynPtr DynGet(obj, num)
fprintf(stderr, "dyn: get: bad index %d\n", num);
return NULL;
}
-
+
if (num >= obj->num_el) {
if (obj->debug)
fprintf(stderr, "dyn: get: highest element is %d.\n",
obj->num_el);
return NULL;
}
-
+
if (obj->debug)
fprintf(stderr, "dyn: get: Returning address %p + %d.\n",
obj->array, obj->el_size*num);
-
+
return (DynPtr) obj->array + obj->el_size*num;
}
@@ -347,7 +347,7 @@ int DynAdd(obj, el)
void *el;
{
int ret;
-
+
ret = DynPut(obj, el, obj->num_el);
if (ret != DYN_OK)
return ret;
@@ -371,7 +371,7 @@ int DynPut(obj, el_in, idx)
{
DynPtr el = (DynPtr) el_in;
int ret;
-
+
if (obj->debug)
fprintf(stderr, "dyn: put: Writing %d bytes from %p to %p + %d\n",
obj->el_size, el, obj->array, idx*obj->el_size);
@@ -383,7 +383,7 @@ int DynPut(obj, el_in, idx)
if (obj->debug)
fprintf(stderr, "dyn: put: done.\n");
-
+
return DYN_OK;
}
@@ -402,7 +402,7 @@ int _DynResize(obj, req)
int req;
{
int size;
-
+
if (obj->size > req)
return DYN_OK;
else if (obj->inc > 0)
@@ -410,9 +410,9 @@ int _DynResize(obj, req)
else {
if (obj->size == 0)
size = -obj->inc;
- else
+ else
size = obj->size;
-
+
/*@-shiftsigned@*/
while (size <= req)
size <<= 1;
@@ -426,7 +426,7 @@ int _DynResize(obj, req)
* Resize the array by num_incs units. If obj->inc is positive, this
* means make it obj->inc*num_incs elements larger. If obj->inc is
* negative, this means make the array num_incs elements long.
- *
+ *
* Ideally, this function should not be called from outside the
* library. However, nothing will break if it is.
*/
@@ -441,13 +441,13 @@ int _DynRealloc(obj, num_incs)
new_size_in_bytes = obj->el_size*(obj->size + obj->inc*num_incs);
else
new_size_in_bytes = obj->el_size*num_incs;
-
+
if (obj->debug)
fprintf(stderr,
"dyn: alloc: Increasing object by %d bytes (%d incs).\n",
new_size_in_bytes - obj->el_size*obj->size,
num_incs);
-
+
temp = (DynPtr) realloc(obj->array, (size_t) new_size_in_bytes);
if (temp == NULL) {
if (obj->debug)
@@ -464,7 +464,7 @@ int _DynRealloc(obj, num_incs)
if (obj->debug)
fprintf(stderr, "dyn: alloc: done.\n");
-
+
return DYN_OK;
}
@@ -546,7 +546,7 @@ Sat Dec 6 22:50:03 1997 Ezra Peisach <epeisach@mit.edu>
Mon Jul 22 21:37:52 1996 Ezra Peisach <epeisach@mit.edu>
* dyn.h: If __STDC__ is not defined, generate prototypes implying
- functions and not variables.
+ functions and not variables.
Mon Jul 22 04:20:48 1996 Marc Horowitz <marc@mit.edu>