From d3a0537b7772e087437913a115f88c8f48e0348c Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sun, 21 Nov 2010 10:16:26 +0000 Subject: [PATCH] rx: Rework identity copying Change the behaviour of the rx_identity_copy function so that it copies the whole identity, not just the contents. Add a new function rx_identity_copyContents which just copies the contents of an identity into an existing identity structure. This restores symmetry with the free and freeContents functions. Change-Id: I692ac8434b1538c283a8ae713956be8ae67cccfd Reviewed-on: http://gerrit.openafs.org/3352 Reviewed-by: Derrick Brashear Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/rx/rx_identity.c | 21 +++++++++++++++++++-- src/rx/rx_identity.h | 3 ++- src/shlibafsrpc/libafsrpc.map | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/rx/rx_identity.c b/src/rx/rx_identity.c index 6391988f6..5a7148690 100644 --- a/src/rx/rx_identity.c +++ b/src/rx/rx_identity.c @@ -86,10 +86,27 @@ rx_identity_populate(struct rx_identity *identity, rx_identity_kind kind, rx_opaque_populate(&identity->exportedName, enameData, enameLength); } - /*! * Copy an identity * + * Create a new identity as a copy of an existing one. + * + * @param from + * The identity to copy from + * @return + * The new identity + */ +struct rx_identity * +rx_identity_copy(struct rx_identity *from) +{ + return rx_identity_new(from->kind, from->displayName, + from->exportedName.val, from->exportedName.len); +} + + +/*! + * Copy an identity's contents + * * Copy the contents of one identity into another one. This will replace * (without freeing) any existing identity contents * @@ -100,7 +117,7 @@ rx_identity_populate(struct rx_identity *identity, rx_identity_kind kind, */ void -rx_identity_copy(struct rx_identity *to, struct rx_identity *from) +rx_identity_copyContents(struct rx_identity *to, struct rx_identity *from) { rx_identity_populate(to, from->kind, from->displayName, from->exportedName.val, from->exportedName.len); diff --git a/src/rx/rx_identity.h b/src/rx/rx_identity.h index eaadc094d..a395e9fa5 100644 --- a/src/rx/rx_identity.h +++ b/src/rx/rx_identity.h @@ -43,7 +43,8 @@ struct rx_identity *rx_identity_new(rx_identity_kind, char *, void *, int rx_identity_match(struct rx_identity *a, struct rx_identity *b); void rx_identity_populate(struct rx_identity *, rx_identity_kind, char *, void *, size_t); -void rx_identity_copy(struct rx_identity *to, struct rx_identity *from); +struct rx_identity *rx_identity_copy(struct rx_identity *from); +void rx_identity_copyContents(struct rx_identity *to, struct rx_identity *from); void rx_identity_freeContents(struct rx_identity *identity); void rx_identity_free(struct rx_identity **identity); diff --git a/src/shlibafsrpc/libafsrpc.map b/src/shlibafsrpc/libafsrpc.map index ac4af97f9..46194470d 100755 --- a/src/shlibafsrpc/libafsrpc.map +++ b/src/shlibafsrpc/libafsrpc.map @@ -154,6 +154,7 @@ rx_identity_match; rx_identity_populate; rx_identity_copy; + rx_identity_copyContents; rx_identity_new; rx_identity_freeContents; rx_identity_free; -- 2.39.5