diff options
author | Michael Schroeder <mls@suse.de> | 2013-09-13 16:30:53 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2013-09-13 16:30:53 +0200 |
commit | a7875e935f415997ca14e741b06dcc25b6f6359d (patch) | |
tree | b59fa0053d93b2ea4c75670a3f3c3f20fc1040a9 /src/transaction.c | |
parent | 75941c2115f0e8ec9696de2a22198a1969aaef77 (diff) | |
download | libsolv-a7875e935f415997ca14e741b06dcc25b6f6359d.tar.gz libsolv-a7875e935f415997ca14e741b06dcc25b6f6359d.tar.bz2 libsolv-a7875e935f415997ca14e741b06dcc25b6f6359d.zip |
add solv_memdup and solv_memdup2 inline helper functions
Diffstat (limited to 'src/transaction.c')
-rw-r--r-- | src/transaction.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/transaction.c b/src/transaction.c index 0e266fa..5fe90db 100644 --- a/src/transaction.c +++ b/src/transaction.c @@ -861,8 +861,7 @@ transaction_create_clone(Transaction *srctrans) if (srctrans->transaction_installed) { Repo *installed = srctrans->pool->installed; - trans->transaction_installed = solv_calloc(installed->end - installed->start, sizeof(Id)); - memcpy(trans->transaction_installed, srctrans->transaction_installed, (installed->end - installed->start) * sizeof(Id)); + trans->transaction_installed = solv_memdup2(srctrans->transaction_installed, installed->end - installed->start, sizeof(Id)); } map_init_clone(&trans->transactsmap, &srctrans->transactsmap); map_init_clone(&trans->multiversionmap, &srctrans->multiversionmap); @@ -870,11 +869,9 @@ transaction_create_clone(Transaction *srctrans) { struct _TransactionOrderdata *od = srctrans->orderdata; trans->orderdata = solv_calloc(1, sizeof(*trans->orderdata)); - trans->orderdata->tes = solv_malloc2(od->ntes, sizeof(*od->tes)); - memcpy(trans->orderdata->tes, od->tes, od->ntes * sizeof(*od->tes)); + trans->orderdata->tes = solv_memdup2(od->tes, od->ntes, sizeof(*od->tes)); trans->orderdata->ntes = od->ntes; - trans->orderdata->invedgedata = solv_malloc2(od->ninvedgedata, sizeof(Id)); - memcpy(trans->orderdata->invedgedata, od->invedgedata, od->ninvedgedata * sizeof(Id)); + trans->orderdata->invedgedata = solv_memdup2(od->invedgedata, od->ninvedgedata, sizeof(Id)); trans->orderdata->ninvedgedata = od->ninvedgedata; } return trans; |