Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: crypto/kernel/alloc.c

Issue 2344973002: Update libsrtp to version 2.0 (Closed)
Patch Set: Add '.' back to include_dirs Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/include/stat.h ('k') | crypto/kernel/crypto_kernel.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/kernel/alloc.c
diff --git a/srtp/crypto/kernel/alloc.c b/crypto/kernel/alloc.c
similarity index 78%
rename from srtp/crypto/kernel/alloc.c
rename to crypto/kernel/alloc.c
index e728798c8101efe6acae553fe05abf09ce20358d..d82353070dc352d65415ef705b86fdd7728096a7 100644
--- a/srtp/crypto/kernel/alloc.c
+++ b/crypto/kernel/alloc.c
@@ -51,52 +51,23 @@
/* the debug module for memory allocation */
-debug_module_t mod_alloc = {
+srtp_debug_module_t mod_alloc = {
0, /* debugging is off by default */
"alloc" /* printable name for module */
};
/*
- * Nota bene: the debugging statements for crypto_alloc() and
- * crypto_free() have identical prefixes, which include the addresses
+ * Nota bene: the debugging statements for srtp_crypto_alloc() and
+ * srtp_crypto_free() have identical prefixes, which include the addresses
* of the memory locations on which they are operating. This fact can
* be used to locate memory leaks, by turning on memory debugging,
* grepping for 'alloc', then matching alloc and free calls by
* address.
*/
-#ifdef SRTP_KERNEL_LINUX
+#if defined(HAVE_STDLIB_H)
-#include <linux/interrupt.h>
-
-void *
-crypto_alloc(size_t size) {
- void *ptr;
-
- ptr = kmalloc(size, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
-
- if (ptr) {
- debug_print(mod_alloc, "(location: %p) allocated", ptr);
- } else {
- debug_print(mod_alloc, "allocation failed (asked for %d bytes)\n", size);
- }
-
- return ptr;
-}
-
-void
-crypto_free(void *ptr) {
-
- debug_print(mod_alloc, "(location: %p) freed", ptr);
-
- kfree(ptr);
-}
-
-
-#elif defined(HAVE_STDLIB_H)
-
-void *
-crypto_alloc(size_t size) {
+void * srtp_crypto_alloc(size_t size) {
void *ptr;
ptr = malloc(size);
@@ -110,8 +81,7 @@ crypto_alloc(size_t size) {
return ptr;
}
-void
-crypto_free(void *ptr) {
+void srtp_crypto_free(void *ptr) {
debug_print(mod_alloc, "(location: %p) freed", ptr);
« no previous file with comments | « crypto/include/stat.h ('k') | crypto/kernel/crypto_kernel.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698