summaryrefslogtreecommitdiff
path: root/beecrypt/memchunk.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2004-08-02 00:45:38 +0000
committerjbj <devnull@localhost>2004-08-02 00:45:38 +0000
commit8931f04c4dcc79d665aa703594f93ada56b6e0b9 (patch)
treef304054ab421004098182ef6051110ef3aec28bd /beecrypt/memchunk.c
parent8462a31960e9cfd3274b83edd59f9cc3b74c40d2 (diff)
downloadlibrpm-tizen-8931f04c4dcc79d665aa703594f93ada56b6e0b9.tar.gz
librpm-tizen-8931f04c4dcc79d665aa703594f93ada56b6e0b9.tar.bz2
librpm-tizen-8931f04c4dcc79d665aa703594f93ada56b6e0b9.zip
Upgrade to beecrypt-4.0.0.
CVS patchset: 7372 CVS date: 2004/08/02 00:45:38
Diffstat (limited to 'beecrypt/memchunk.c')
-rw-r--r--beecrypt/memchunk.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/beecrypt/memchunk.c b/beecrypt/memchunk.c
index a6dc139dd..c18295792 100644
--- a/beecrypt/memchunk.c
+++ b/beecrypt/memchunk.c
@@ -1,6 +1,4 @@
/*
- * memchunk.c
- *
* Copyright (c) 2001 Virtual Unlimited B.V.
*
* This library is free software; you can redistribute it and/or
@@ -23,21 +21,22 @@
* \author Bob Deblier <bob.deblier@pandora.be>
*/
-#include "system.h"
-#include "memchunk.h"
-#include "debug.h"
+#define BEECRYPT_DLL_EXPORT
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "beecrypt/memchunk.h"
-/*@-compdef@*/ /* tmp->data is undefined */
memchunk* memchunkAlloc(size_t size)
{
- memchunk* tmp = (memchunk*) calloc(1, sizeof(*tmp));
+ memchunk* tmp = (memchunk*) calloc(1, sizeof(memchunk));
if (tmp)
{
tmp->size = size;
- /*@-mustfree@*/ /* tmp->data is OK */
tmp->data = (byte*) malloc(size);
- /*@=mustfree@*/
if (tmp->data == (byte*) 0)
{
@@ -48,7 +47,23 @@ memchunk* memchunkAlloc(size_t size)
return tmp;
}
-/*@=compdef@*/
+
+void memchunkInit(memchunk* m)
+{
+ m->data = (byte*) 0;
+ m->size = 0;
+}
+
+void memchunkWipe(memchunk* m)
+{
+ if (m)
+ {
+ if (m->data)
+ {
+ memset(m->data, 0, m->size);
+ }
+ }
+}
void memchunkFree(memchunk* m)
{
@@ -67,7 +82,6 @@ void memchunkFree(memchunk* m)
memchunk* memchunkResize(memchunk* m, size_t size)
{
- /*@-branchstate@*/
if (m)
{
if (m->data)
@@ -81,15 +95,10 @@ memchunk* memchunkResize(memchunk* m, size_t size)
m = (memchunk*) 0;
}
else
- /*@-nullderef@*/
m->size = size;
- /*@=nullderef@*/
}
- /*@=branchstate@*/
- /*@-nullret -compdef @*/ /* LCL: m->data might be NULL */
return m;
- /*@=nullret =compdef@*/
}
memchunk* memchunkClone(const memchunk* m)