/** * cr_font_size_copy: * @a_dst: the destination #CRFontSize (where to copy to). * @a_src: the source #CRFontSize (where to copy from). * * Returns CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_font_size_copy (CRFontSize * a_dst, CRFontSize const * a_src) { g_return_val_if_fail (a_dst && a_src, CR_BAD_PARAM_ERROR); switch (a_src->type) { case PREDEFINED_ABSOLUTE_FONT_SIZE: case RELATIVE_FONT_SIZE: case INHERITED_FONT_SIZE: cr_font_size_clear (a_dst); memcpy (a_dst, a_src, sizeof (CRFontSize)); break; case ABSOLUTE_FONT_SIZE: cr_font_size_clear (a_dst); cr_num_copy (&a_dst->value.absolute, &a_src->value.absolute); a_dst->type = a_src->type; break; default: return CR_UNKNOWN_TYPE_ERROR; } return CR_OK; }
/** * cr_num_dup: *@a_this: the instance of #CRNum to duplicate. * *Duplicates an instance of #CRNum * *Returns the newly created (duplicated) instance of #CRNum. *Must be freed by cr_num_destroy(). */ CRNum * cr_num_dup (CRNum * a_this) { CRNum *result = NULL; enum CRStatus status = CR_OK; g_return_val_if_fail (a_this, NULL); result = cr_num_new (); g_return_val_if_fail (result, NULL); status = cr_num_copy (result, a_this); g_return_val_if_fail (status == CR_OK, NULL); return result; }