From 2a767bf372052f913ae872068d6b555d899953a3 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 4 Mar 2013 15:51:14 +0100 Subject: Add crystal_copy() --- libcrystfel/src/crystal.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'libcrystfel/src/crystal.c') diff --git a/libcrystfel/src/crystal.c b/libcrystfel/src/crystal.c index 664d933e..02255110 100644 --- a/libcrystfel/src/crystal.c +++ b/libcrystfel/src/crystal.c @@ -96,6 +96,30 @@ Crystal *crystal_new() } +/** + * crystal_copy: + * @cryst: A %Crystal to copy. + * + * Creates a new %Crystal which is a copy of @cryst. The copy is a "shallow + * copy", which means that copies are NOT made of the data structures which + * @cryst contains references to, for example its %RefList. + * + * Returns: a (shallow) copy of @cryst, or NULL on failure. + * + */ +Crystal *crystal_copy(Crystal *cryst) +{ + Crystal *c; + + c = crystal_new(); + if ( c == NULL ) return NULL; + + memcpy(c, cryst, sizeof(Crystal)); + + return c; +} + + /** * crystal_free: * @cryst: A %Crystal to free. -- cgit v1.2.3