}
static void
-convertBulkToNBulk(bulkentries *bulk, nbulkentries *nbulk, int *entriesp) {
+convertBulkToNBulk(bulkentries *bulk, nbulkentries *nbulk) {
int i;
+ if (bulk->bulkentries_len == 0)
+ return;
+
+ nbulk->nbulkentries_len = bulk->bulkentries_len;
nbulk->nbulkentries_val =
- (nvldbentry *) xdr_alloc(*entriesp * sizeof(struct nvldbentry));
+ xdr_alloc(bulk->bulkentries_len * sizeof(struct nvldbentry));
- for (i = 0; i < *entriesp; i++) { /* process each entry */
+ for (i = 0; i < bulk->bulkentries_len; i++) {
ovlentry_to_nvlentry(&bulk->bulkentries_val[i],
&nbulk->nbulkentries_val[i]);
}
}
static void
-convertBulkToUBulk(bulkentries *bulk, ubulkentries *ubulk, int *entriesp) {
+convertBulkToUBulk(bulkentries *bulk, ubulkentries *ubulk) {
int i;
+ if (bulk->bulkentries_len == 0)
+ return;
+
+ ubulk->ubulkentries_len = bulk->bulkentries_len;
ubulk->ubulkentries_val =
- (uvldbentry *) xdr_alloc(*entriesp * sizeof(struct uvldbentry));
- for (i = 0; i < *entriesp; i++) { /* process each entry */
+ xdr_alloc(bulk->bulkentries_len * sizeof(struct uvldbentry));
+ for (i = 0; i < bulk->bulkentries_len; i++) {
ovlentry_to_uvlentry(&bulk->bulkentries_val[i],
&ubulk->ubulkentries_val[i]);
}
}
static void
-convertNBulkToUBulk(nbulkentries *nbulk, ubulkentries *ubulk, int *entriesp) {
+convertNBulkToUBulk(nbulkentries *nbulk, ubulkentries *ubulk) {
int i;
+ if (nbulk->nbulkentries_len == 0)
+ return;
+
+ ubulk->ubulkentries_len = nbulk->nbulkentries_len;
ubulk->ubulkentries_val =
- (uvldbentry *) xdr_alloc(*entriesp * sizeof(struct uvldbentry));
- for (i = 0; i < *entriesp; i++) { /* process each entry */
+ xdr_alloc(nbulk->nbulkentries_len * sizeof(struct uvldbentry));
+ for (i = 0; i < nbulk->nbulkentries_len; i++) { /* process each entry */
nvlentry_to_uvlentry(&nbulk->nbulkentries_val[i],
&ubulk->ubulkentries_val[i]);
}
if (newvlserver == vltype_old) {
bulkentries arrayEntries;
tryold:
- memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */
+ memset(&arrayEntries, 0, sizeof(arrayEntries));
code =
ubik_VL_ListAttributes(cstruct, 0, attrp, entriesp,
&arrayEntries);
- if (!code)
- convertBulkToNBulk(&arrayEntries, blkentriesp, entriesp);
+ if (code)
+ return code;
+
+ convertBulkToNBulk(&arrayEntries, blkentriesp);
- if (arrayEntries.bulkentries_val)
- xdr_free((xdrproc_t) xdr_bulkentries, &arrayEntries);
+ xdr_free((xdrproc_t) xdr_bulkentries, &arrayEntries);
return code;
}
if (newvlserver == vltype_old) {
bulkentries arrayEntries;
tryold:
- memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */
+ memset(&arrayEntries, 0, sizeof(arrayEntries));
code =
ubik_VL_ListAttributes(cstruct, 0, attrp, entriesp,
&arrayEntries);
- if (!code)
- convertBulkToUBulk(&arrayEntries, blkentriesp, entriesp);
+ if (code)
+ return code;
+
+ convertBulkToUBulk(&arrayEntries, blkentriesp);
- if (arrayEntries.bulkentries_val)
- xdr_free((xdrproc_t) xdr_bulkentries, &arrayEntries);
+ xdr_free((xdrproc_t) xdr_bulkentries, &arrayEntries);
return code;
}
- memset(&narrayEntries, 0, sizeof(narrayEntries)); /*initialize to hint the stub to alloc space */
+ memset(&narrayEntries, 0, sizeof(narrayEntries));
code =
ubik_VL_ListAttributesN(cstruct, 0, attrp, entriesp, &narrayEntries);
if (code == RXGEN_OPCODE) {
newvlserver = vltype_old; /* Doesn't support new interface */
goto tryold;
}
- if (!code) {
- convertNBulkToUBulk(&narrayEntries, blkentriesp, entriesp);
- }
- if (narrayEntries.nbulkentries_val)
- xdr_free((xdrproc_t) xdr_bulkentries, &narrayEntries);
+ if (code)
+ return code;
+
+ convertNBulkToUBulk(&narrayEntries, blkentriesp);
+
+ xdr_free((xdrproc_t) xdr_bulkentries, &narrayEntries);
return code;
}
code =
ubik_VL_ListAttributesN2(cstruct, 0, attrp, (name ? name : ""),
thisindex, nentriesp, &narrayEntries, nextindexp);
- if (!code)
- convertNBulkToUBulk(&narrayEntries, blkentriesp, nentriesp);
+ if (code)
+ return code;
+
+ convertNBulkToUBulk(&narrayEntries, blkentriesp);
- if (narrayEntries.nbulkentries_val)
- xdr_free((xdrproc_t) xdr_bulkentries, &narrayEntries);
+ xdr_free((xdrproc_t) xdr_bulkentries, &narrayEntries);
return code;
}
return code;