summaryrefslogtreecommitdiff
path: root/libgphoto2/gphoto2-abilities-list.c
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2014-07-21 20:44:18 +0000
committerMarcus Meissner <marcus@jet.franken.de>2014-07-21 20:44:18 +0000
commitb0d404cae50bd0aff73a73c3722cc3cfb81e7d25 (patch)
tree257525aaf8d727054bc00553d84226113125817d /libgphoto2/gphoto2-abilities-list.c
parentb04b755500defcb12d4152db13dc52fbdfa8f443 (diff)
downloadlibgphoto2-b0d404cae50bd0aff73a73c3722cc3cfb81e7d25.tar.gz
From: Axel Waggershauser <awagger@web.de>
3) use the fact that realloc() is defined to simply malloc if the first param is NULL, no need to manually distinguish between first and later allocations. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@15098 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2/gphoto2-abilities-list.c')
-rw-r--r--libgphoto2/gphoto2-abilities-list.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/libgphoto2/gphoto2-abilities-list.c b/libgphoto2/gphoto2-abilities-list.c
index 3f056bdb2..4aad66f95 100644
--- a/libgphoto2/gphoto2-abilities-list.c
+++ b/libgphoto2/gphoto2-abilities-list.c
@@ -511,16 +511,10 @@ remove_colon_from_string (char *str)
int
gp_abilities_list_append (CameraAbilitiesList *list, CameraAbilities abilities)
{
- CameraAbilities *new_abilities;
-
CHECK_NULL (list);
- if (!list->count)
- C_MEM( new_abilities = malloc (sizeof (CameraAbilities)) );
- else
- C_MEM (new_abilities = realloc (list->abilities,
- sizeof (CameraAbilities) * (list->count + 1)));
- list->abilities = new_abilities;
+ C_MEM (list->abilities = realloc (list->abilities,
+ sizeof (CameraAbilities) * (list->count + 1)));
memcpy (&(list->abilities [list->count]), &abilities,
sizeof (CameraAbilities));