[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Fri Jul 18 07:44:04 MDT 2014
The branch, master has been updated
via 4580702 lib/util: move memcache.[ch] to the toplevel 'samba-util' library
via b560fac s3:lib/memcache: only include the required header files
via 91105d1 s3:lib/memcache: make use of talloc for memcache_elements
via d7cbc63 s3:lib/memcache: use uint8_t instead of uint8
from 8d33cdd ldb-samba: fix a memory leak in ldif_canonicalise_objectCategory()
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 45807028d478c082fef6f3a3d5a142d96d63fb50
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Jul 17 12:58:34 2014 +0200
lib/util: move memcache.[ch] to the toplevel 'samba-util' library
This is generic enough that it could be used in all code.
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Fri Jul 18 15:43:33 CEST 2014 on sn-devel-104
commit b560fac7f78b761ee279d8e87a749125665eb5d1
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Jul 17 12:49:48 2014 +0200
s3:lib/memcache: only include the required header files
We don't need the full "includes.h".
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit 91105d1057c29c5878f50678baeb1bd1a6f1abe3
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Jul 17 12:48:51 2014 +0200
s3:lib/memcache: make use of talloc for memcache_elements
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit d7cbc63dc7537fc9562da985b77f6d62dc41fd84
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Jul 17 12:41:20 2014 +0200
s3:lib/memcache: use uint8_t instead of uint8
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
-----------------------------------------------------------------------
Summary of changes:
{source3/lib => lib/util}/memcache.c | 22 +++++++++++++---------
{source3/include => lib/util}/memcache.h | 2 --
lib/util/wscript_build | 2 +-
source3/auth/token_util.c | 2 +-
source3/lib/access.c | 2 +-
source3/lib/gencache.c | 2 +-
source3/lib/id_cache.c | 2 +-
source3/lib/username.c | 2 +-
source3/lib/util_sock.c | 2 +-
source3/passdb/lookup_sid.c | 2 +-
source3/passdb/pdb_interface.c | 2 +-
source3/smbd/dir.c | 2 +-
source3/smbd/globals.c | 2 +-
source3/smbd/mangle_hash2.c | 2 +-
source3/smbd/server.c | 2 +-
source3/smbd/statcache.c | 2 +-
source3/smbd/vfs.c | 2 +-
source3/torture/torture.c | 2 +-
source3/wscript_build | 2 +-
19 files changed, 30 insertions(+), 28 deletions(-)
rename {source3/lib => lib/util}/memcache.c (95%)
rename {source3/include => lib/util}/memcache.h (99%)
Changeset truncated at 500 lines:
diff --git a/source3/lib/memcache.c b/lib/util/memcache.c
similarity index 95%
rename from source3/lib/memcache.c
rename to lib/util/memcache.c
index 88453f3..50e59fc 100644
--- a/source3/lib/memcache.c
+++ b/lib/util/memcache.c
@@ -17,8 +17,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "memcache.h"
+#include "replace.h"
+#include <talloc.h>
+#include "../lib/util/samba_util.h"
+#include "../lib/util/debug.h"
+#include "../lib/util/dlinklist.h"
#include "../lib/util/rbtree.h"
+#include "memcache.h"
static struct memcache *global_cache;
@@ -26,7 +31,7 @@ struct memcache_element {
struct rb_node rb_node;
struct memcache_element *prev, *next;
size_t keylength, valuelength;
- uint8 n; /* This is really an enum, but save memory */
+ uint8_t n; /* This is really an enum, but save memory */
char data[1]; /* placeholder for offsetof */
};
@@ -63,7 +68,7 @@ static int memcache_destructor(struct memcache *cache) {
for (e = cache->mru; e != NULL; e = next) {
next = e->next;
- SAFE_FREE(e);
+ TALLOC_FREE(e);
}
return 0;
}
@@ -96,7 +101,7 @@ static struct memcache_element *memcache_node2elem(struct rb_node *node)
static void memcache_element_parse(struct memcache_element *e,
DATA_BLOB *key, DATA_BLOB *value)
{
- key->data = ((uint8 *)e) + offsetof(struct memcache_element, data);
+ key->data = ((uint8_t *)e) + offsetof(struct memcache_element, data);
key->length = e->keylength;
value->data = key->data + e->keylength;
value->length = e->valuelength;
@@ -206,7 +211,7 @@ static void memcache_delete_element(struct memcache *cache,
cache->size -= memcache_element_size(e->keylength, e->valuelength);
- SAFE_FREE(e);
+ TALLOC_FREE(e);
}
static void memcache_trim(struct memcache *cache)
@@ -285,13 +290,12 @@ void memcache_add(struct memcache *cache, enum memcache_number n,
element_size = memcache_element_size(key.length, value.length);
-
- e = (struct memcache_element *)SMB_MALLOC(element_size);
-
+ e = talloc_size(cache, element_size);
if (e == NULL) {
- DEBUG(0, ("malloc failed\n"));
+ DEBUG(0, ("talloc failed\n"));
return;
}
+ talloc_set_type(e, struct memcache_element);
e->n = n;
e->keylength = key.length;
diff --git a/source3/include/memcache.h b/lib/util/memcache.h
similarity index 99%
rename from source3/include/memcache.h
rename to lib/util/memcache.h
index d5a0376..97490b9 100644
--- a/source3/include/memcache.h
+++ b/lib/util/memcache.h
@@ -20,8 +20,6 @@
#ifndef __MEMCACHE_H__
#define __MEMCACHE_H__
-#include "includes.h"
-
struct memcache;
/*
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index fe2c183..bcb7b66 100755
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -8,7 +8,7 @@ bld.SAMBA_LIBRARY('samba-util',
util_strlist.c util_paths.c idtree.c debug.c fault.c base64.c
util_str.c util_str_common.c substitute.c ms_fnmatch.c
server_id.c dprintf.c parmlist.c bitmap.c pidfile.c
- tevent_debug.c util_process.c''',
+ tevent_debug.c util_process.c memcache.c''',
deps='DYNCONFIG',
public_deps='talloc tevent execinfo pthread LIBCRYPTO charset util_setid systemd-daemon',
public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h xfile.h dlinklist.h samba_util.h string_wrappers.h',
diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c
index 8b0174f..9bb014c 100644
--- a/source3/auth/token_util.c
+++ b/source3/auth/token_util.c
@@ -28,7 +28,7 @@
#include "system/passwd.h"
#include "auth.h"
#include "secrets.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "../librpc/gen_ndr/netlogon.h"
#include "../libcli/security/security.h"
#include "../lib/util/util_pw.h"
diff --git a/source3/lib/access.c b/source3/lib/access.c
index a2de35c..58db722 100644
--- a/source3/lib/access.c
+++ b/source3/lib/access.c
@@ -11,7 +11,7 @@
*/
#include "includes.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "lib/socket/interfaces.h"
#define NAME_INDEX 0
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index 0fb1fd8..3e67d9e 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -25,7 +25,7 @@
#include "system/filesys.h"
#include "system/glob.h"
#include "util_tdb.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_TDB
diff --git a/source3/lib/id_cache.c b/source3/lib/id_cache.c
index e6e3457..3a703ae 100644
--- a/source3/lib/id_cache.c
+++ b/source3/lib/id_cache.c
@@ -28,7 +28,7 @@
#include "includes.h"
#include "messages.h"
#include "lib/id_cache.h"
-#include "include/memcache.h"
+#include "../lib/util/memcache.h"
#include "idmap_cache.h"
#include "../librpc/gen_ndr/ndr_security.h"
#include "../libcli/security/dom_sid.h"
diff --git a/source3/lib/username.c b/source3/lib/username.c
index 847aa33..f69d9c3 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -21,7 +21,7 @@
#include "includes.h"
#include "system/passwd.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "../lib/util/util_pw.h"
/* internal functions */
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index c5de61a..522f600 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -21,7 +21,7 @@
#include "includes.h"
#include "system/filesys.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "../lib/async_req/async_sock.h"
#include "../lib/util/select.h"
#include "lib/socket/interfaces.h"
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c
index fa44f3e..5f24d78 100644
--- a/source3/passdb/lookup_sid.c
+++ b/source3/passdb/lookup_sid.c
@@ -23,7 +23,7 @@
#include "passdb.h"
#include "../librpc/gen_ndr/ndr_security.h"
#include "secrets.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "idmap_cache.h"
#include "../libcli/security/security.h"
#include "lib/winbind_util.h"
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 2c82856..ed42961 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -29,7 +29,7 @@
#include "../librpc/gen_ndr/drsblobs.h"
#include "../librpc/gen_ndr/ndr_drsblobs.h"
#include "../librpc/gen_ndr/idmap.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "nsswitch/winbind_client.h"
#include "../libcli/security/security.h"
#include "../lib/util/util_pw.h"
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 818f778..55d7742 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -24,7 +24,7 @@
#include "smbd/globals.h"
#include "libcli/security/security.h"
#include "lib/util/bitmap.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
/*
This module implements directory related functions for Samba.
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 3eb65a1..e03c7c4 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -20,7 +20,7 @@
#include "includes.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "messages.h"
#include "tdb_compat.h"
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c
index c2910f8..ac1f4b0 100644
--- a/source3/smbd/mangle_hash2.c
+++ b/source3/smbd/mangle_hash2.c
@@ -66,7 +66,7 @@
#include "includes.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "mangle.h"
#if 1
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index bafd493..dd1e20a 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -29,7 +29,7 @@
#include "registry/reg_init_full.h"
#include "libcli/auth/schannel.h"
#include "secrets.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "ctdbd_conn.h"
#include "util_cluster.h"
#include "printing/queue_process.h"
diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c
index 92010c2..2f3b067 100644
--- a/source3/smbd/statcache.c
+++ b/source3/smbd/statcache.c
@@ -21,7 +21,7 @@
*/
#include "includes.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "smbd/smbd.h"
#include "messages.h"
#include "smbprofile.h"
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index d5390ed..3574049 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -27,7 +27,7 @@
#include "system/filesys.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "transfer_file.h"
#include "ntioctl.h"
#include "lib/util/tevent_unix.h"
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index eb3958e..ba23a85 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -26,7 +26,7 @@
#include "tldap.h"
#include "tldap_util.h"
#include "../librpc/gen_ndr/svcctl.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "nsswitch/winbind_client.h"
#include "dbwrap/dbwrap.h"
#include "dbwrap/dbwrap_open.h"
diff --git a/source3/wscript_build b/source3/wscript_build
index 6f668ba..38f0d12 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -765,7 +765,7 @@ bld.SAMBA3_SUBSYSTEM('tdb-wrap3',
deps='talloc samba3-util')
bld.SAMBA3_LIBRARY('samba3-util',
- source='''lib/util_sec.c lib/util_str.c lib/adt_tree.c lib/util_malloc.c lib/memcache.c lib/namearray.c lib/file_id.c''',
+ source='''lib/util_sec.c lib/util_str.c lib/adt_tree.c lib/util_malloc.c lib/namearray.c lib/file_id.c''',
deps='samba-util charset',
private_library=True)
--
Samba Shared Repository
More information about the samba-cvs
mailing list