summaryrefslogtreecommitdiffstats
path: root/ctdb/lib/talloc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-07-10 15:46:05 +1000
committerAndrew Tridgell <tridge@samba.org>2007-07-10 15:46:05 +1000
commita4c96397f59232219ddc1c79333093c2fcbbd2ef (patch)
tree02e18506e25b49149328fcdc73b0a0371c5018da /ctdb/lib/talloc
parenta78752eae42134cb54d67db6ec9b8a4cd9103ab4 (diff)
more merges for GPLv3 update
(This used to be ctdb commit b7be4ee6c9a670cdf148fd36b092c3991a554964)
Diffstat (limited to 'ctdb/lib/talloc')
-rwxr-xr-xctdb/lib/talloc/config.guess4
-rw-r--r--ctdb/lib/talloc/config.h.in33
-rwxr-xr-xctdb/lib/talloc/config.sub4
-rw-r--r--ctdb/lib/talloc/configure.ac2
-rw-r--r--ctdb/lib/talloc/talloc.3.xml24
-rw-r--r--ctdb/lib/talloc/talloc.c3
-rw-r--r--ctdb/lib/talloc/talloc.h3
-rw-r--r--ctdb/lib/talloc/talloc_guide.txt19
-rw-r--r--ctdb/lib/talloc/testsuite.c45
9 files changed, 108 insertions, 29 deletions
diff --git a/ctdb/lib/talloc/config.guess b/ctdb/lib/talloc/config.guess
index 30af5be004..354dbe175a 100755
--- a/ctdb/lib/talloc/config.guess
+++ b/ctdb/lib/talloc/config.guess
@@ -16,9 +16,7 @@ timestamp='2005-08-03'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
diff --git a/ctdb/lib/talloc/config.h.in b/ctdb/lib/talloc/config.h.in
index 407af7c8d4..8bbf16e709 100644
--- a/ctdb/lib/talloc/config.h.in
+++ b/ctdb/lib/talloc/config.h.in
@@ -6,6 +6,12 @@
/* Whether strnlen is broken */
#undef BROKEN_STRNLEN
+/* Whether dlopen takes unsinged int flags */
+#undef DLOPEN_TAKES_UNSIGNED_FLAGS
+
+/* Define to 1 if you have the <acl/libacl.h> header file. */
+#undef HAVE_ACL_LIBACL_H
+
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
@@ -74,9 +80,6 @@
/* Define to 1 if you have the `dlsym' function. */
#undef HAVE_DLSYM
-/* Define to 1 if you have the `endnetgrent' function. */
-#undef HAVE_ENDNETGRENT
-
/* Whether errno() is available */
#undef HAVE_ERRNO_DECL
@@ -98,9 +101,6 @@
/* Define to 1 if you have the `getdirentries' function. */
#undef HAVE_GETDIRENTRIES
-/* Define to 1 if you have the `getnetgrent' function. */
-#undef HAVE_GETNETGRENT
-
/* Define to 1 if you have the `getpgrp' function. */
#undef HAVE_GETPGRP
@@ -113,9 +113,6 @@
/* Define to 1 if you have the `initgroups' function. */
#undef HAVE_INITGROUPS
-/* Define to 1 if you have the `innetgr' function. */
-#undef HAVE_INNETGR
-
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -155,6 +152,9 @@
/* Whether mmap works */
#undef HAVE_MMAP
+/* Define to 1 if you have the <mntent.h> header file. */
+#undef HAVE_MNTENT_H
+
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
@@ -218,6 +218,9 @@
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
+/* Whether setenv() is available */
+#undef HAVE_SETENV_DECL
+
/* Define to 1 if you have the `seteuid' function. */
#undef HAVE_SETEUID
@@ -227,9 +230,6 @@
/* Define to 1 if you have the `setlinebuf' function. */
#undef HAVE_SETLINEBUF
-/* Define to 1 if you have the `setnetgrent' function. */
-#undef HAVE_SETNETGRENT
-
/* Define to 1 if you have the `setresgid' function. */
#undef HAVE_SETRESGID
@@ -373,6 +373,9 @@
/* Define to 1 if you have the <sys/mode.h> header file. */
#undef HAVE_SYS_MODE_H
+/* Define to 1 if you have the <sys/mount.h> header file. */
+#undef HAVE_SYS_MOUNT_H
+
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
@@ -437,6 +440,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if you have the `unsetenv' function. */
+#undef HAVE_UNSETENV
+
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP
@@ -524,6 +530,9 @@
/* replace readdir using getdirentries() */
#undef REPLACE_READDIR_GETDIRENTRIES
+/* Whether strptime should be replaced */
+#undef REPLACE_STRPTIME
+
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
diff --git a/ctdb/lib/talloc/config.sub b/ctdb/lib/talloc/config.sub
index f0fcaf6361..23cd6fd75c 100755
--- a/ctdb/lib/talloc/config.sub
+++ b/ctdb/lib/talloc/config.sub
@@ -20,9 +20,7 @@ timestamp='2005-07-08'
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
diff --git a/ctdb/lib/talloc/configure.ac b/ctdb/lib/talloc/configure.ac
index 5f465fe93a..e1e84b25c3 100644
--- a/ctdb/lib/talloc/configure.ac
+++ b/ctdb/lib/talloc/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ(2.50)
-AC_INIT(talloc, 1.0)
+AC_INIT(talloc, 1.0.1)
AC_CONFIG_SRCDIR([talloc.c])
AC_SUBST(datarootdir)
AC_CONFIG_HEADER(config.h)
diff --git a/ctdb/lib/talloc/talloc.3.xml b/ctdb/lib/talloc/talloc.3.xml
index 41b748b4ba..67de15bfc8 100644
--- a/ctdb/lib/talloc/talloc.3.xml
+++ b/ctdb/lib/talloc/talloc.3.xml
@@ -583,11 +583,27 @@ if (ptr) memcpy(ptr, p, strlen(p)+1);</programlisting>
</para>
<programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
</refsect2>
+ <refsect2><title>char *talloc_append_string(const void *<emphasis role="italic">t</emphasis>, char *<emphasis role="italic">orig</emphasis>, const char *<emphasis role="italic">append</emphasis>);</title>
+ <para>
+ The talloc_append_string() function appends the given formatted
+ string to the given string.
+ </para>
+ <para>
+ This function sets the name of the new pointer to the new
+ string. This is equivalent to:
+ </para>
+ <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
+ </refsect2>
<refsect2><title>char *talloc_vasprintf(const void *<emphasis role="italic">t</emphasis>, const char *<emphasis role="italic">fmt</emphasis>, va_list <emphasis role="italic">ap</emphasis>);</title>
<para>
The talloc_vasprintf() function is the talloc equivalent of the C
library function vasprintf(3).
</para>
+ <para>
+ This function sets the name of the new pointer to the new
+ string. This is equivalent to:
+ </para>
+ <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
</refsect2>
<refsect2><title>char *talloc_asprintf(const void *<emphasis role="italic">t</emphasis>, const char *<emphasis role="italic">fmt</emphasis>, ...);</title>
<para>
@@ -605,6 +621,11 @@ if (ptr) memcpy(ptr, p, strlen(p)+1);</programlisting>
The talloc_asprintf_append() function appends the given formatted
string to the given string.
</para>
+ <para>
+ This function sets the name of the new pointer to the new
+ string. This is equivalent to:
+ </para>
+ <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
</refsect2>
<refsect2><title>(type *)talloc_array(const void *ctx, type, uint_t count);</title>
<para>
@@ -711,8 +732,7 @@ if (ptr) memcpy(ptr, p, strlen(p)+1);</programlisting>
</para>
<para>
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program; if not, see http://www.gnu.org/licenses/.
</para>
</refsect1>
</refentry>
diff --git a/ctdb/lib/talloc/talloc.c b/ctdb/lib/talloc/talloc.c
index d1f17b6c4b..b805c9725c 100644
--- a/ctdb/lib/talloc/talloc.c
+++ b/ctdb/lib/talloc/talloc.c
@@ -23,8 +23,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
/*
diff --git a/ctdb/lib/talloc/talloc.h b/ctdb/lib/talloc/talloc.h
index 6778825822..15130d0d98 100644
--- a/ctdb/lib/talloc/talloc.h
+++ b/ctdb/lib/talloc/talloc.h
@@ -22,8 +22,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
diff --git a/ctdb/lib/talloc/talloc_guide.txt b/ctdb/lib/talloc/talloc_guide.txt
index 6481b58611..c4634ae19a 100644
--- a/ctdb/lib/talloc/talloc_guide.txt
+++ b/ctdb/lib/talloc/talloc_guide.txt
@@ -533,6 +533,15 @@ This functions sets the name of the new pointer to the passed
string. This is equivalent to:
talloc_set_name_const(ptr, ptr)
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+char *talloc_append_string(const void *t, char *orig, const char *append);
+
+The talloc_append_string() function appends the given formatted
+string to the given string.
+
+This function sets the name of the new pointer to the new
+string. This is equivalent to:
+ talloc_set_name_const(ptr, ptr)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
char *talloc_vasprintf(const void *t, const char *fmt, va_list ap);
@@ -540,6 +549,10 @@ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap);
The talloc_vasprintf() function is the talloc equivalent of the C
library function vasprintf()
+This functions sets the name of the new pointer to the new
+string. This is equivalent to:
+ talloc_set_name_const(ptr, ptr)
+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
char *talloc_asprintf(const void *t, const char *fmt, ...);
@@ -547,7 +560,7 @@ char *talloc_asprintf(const void *t, const char *fmt, ...);
The talloc_asprintf() function is the talloc equivalent of the C
library function asprintf()
-This functions sets the name of the new pointer to the passed
+This functions sets the name of the new pointer to the new
string. This is equivalent to:
talloc_set_name_const(ptr, ptr)
@@ -558,6 +571,10 @@ char *talloc_asprintf_append(char *s, const char *fmt, ...);
The talloc_asprintf_append() function appends the given formatted
string to the given string.
+This functions sets the name of the new pointer to the new
+string. This is equivalent to:
+ talloc_set_name_const(ptr, ptr)
+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
(type *)talloc_array(const void *ctx, type, uint_t count);
diff --git a/ctdb/lib/talloc/testsuite.c b/ctdb/lib/talloc/testsuite.c
index 8661d959f7..2e3ae65082 100644
--- a/ctdb/lib/talloc/testsuite.c
+++ b/ctdb/lib/talloc/testsuite.c
@@ -20,8 +20,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "replace.h"
@@ -993,7 +992,7 @@ static bool test_talloc_ptrtype(void)
s4 = talloc_array_ptrtype(top, s4, 10);location4 = __location__;
if (talloc_get_size(s4) != (sizeof(struct struct1 **) * 10)) {
- printf("failure: TALLOC PTRTYPE [\n"
+ printf("failure: ptrtype [\n"
"talloc_array_ptrtype() allocated the wrong size "
"%lu (should be %lu)\n]\n",
(unsigned long)talloc_get_size(s4),
@@ -1010,6 +1009,45 @@ static bool test_talloc_ptrtype(void)
return true;
}
+static int _test_talloc_free_in_destructor(void **ptr)
+{
+ talloc_free(*ptr);
+ return 0;
+}
+
+static bool test_talloc_free_in_destructor(void)
+{
+ void *level0;
+ void *level1;
+ void *level2;
+ void *level3;
+ void *level4;
+ void **level5;
+
+ printf("test: free_in_destructor [\nTALLOC FREE IN DESTRUCTOR\n]\n");
+
+ level0 = talloc_new(NULL);
+ level1 = talloc_new(level0);
+ level2 = talloc_new(level1);
+ level3 = talloc_new(level2);
+ level4 = talloc_new(level3);
+ level5 = talloc(level4, void *);
+
+ *level5 = level3;
+ (void)talloc_reference(level0, level3);
+ (void)talloc_reference(level3, level3);
+ (void)talloc_reference(level5, level3);
+
+ talloc_set_destructor(level5, _test_talloc_free_in_destructor);
+
+ talloc_free(level1);
+
+ talloc_free(level0);
+
+ printf("success: free_in_destructor\n");
+ return true;
+}
+
static bool test_autofree(void)
{
#if _SAMBA_BUILD_ < 4
@@ -1055,6 +1093,7 @@ bool torture_local_talloc(struct torture_context *tctx)
ret &= test_loop();
ret &= test_free_parent_deny_child();
ret &= test_talloc_ptrtype();
+ ret &= test_talloc_free_in_destructor();
if (ret) {
ret &= test_speed();