1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-13 08:23:49 +03:00
Commit Graph

90 Commits

Author SHA1 Message Date
Volker Lendecke
9f402c607f Fix a c++ warning 2008-02-11 15:07:46 +01:00
Volker Lendecke
5cc7a638e9 talloc_free_children can only reset pool if it's empty 2008-02-11 15:07:46 +01:00
Volker Lendecke
6deca23b6c Mark talloc_pool memory for valgrind 2008-02-11 15:07:46 +01:00
Volker Lendecke
60ef9a84f0 Implement talloc_pool()
A talloc pool is a chunk of memory that can be used as a context for further
talloc calls. Allocations with the pool as the parent just chew from that
memory by incrementing a pointer. If the talloc pool is full, then we fall back
to the normal system-level malloc(3) to get memory.

The use case for talloc pools is the transient memory that is used for handling
a single SMB request. Incrementing a pointer will be way faster than any malloc
implementation.

There is a downside of this: If you use talloc_steal() to move something out of
the pool, the whole pool memory is kept around until the last object inside the
pool is freed. So if you talloc_free() the pool, it might happen that the
memory is freed later. So don't hang anything off a talloc pool that should
live long.

Volker
2008-02-11 15:07:46 +01:00
Michael Adam
2a2c28584c Add a comment.
Michael
2008-02-11 15:07:46 +01:00
Michael Adam
a0caedb94f Fix talloctort: move size check after referenced ptr check.
Michael
2008-02-11 15:07:46 +01:00
Volker Lendecke
0c829e6ee6 Don't shrink a talloc area if we have less than 1k to gain 2008-02-11 15:07:46 +01:00
Kai Blin
4a5e1047ff r26514: Revert the talloc.c part of r26511, as talloc.h already takes care of thois.
Thanks to metze for pointing this out
2007-12-21 05:51:19 +01:00
Kai Blin
5b3a8c8ae1 r26511: Janitorial: Fix a warning for the 'printf' attribute on gendb_search_v
While at it, also add a PRINTF_ATTRIBUTE for talloc_vasprintf.
2007-12-21 05:51:17 +01:00
Stefan Metzmacher
2b2e841465 r25216: make talloc_append_string() a deprecated macro instead of
having it as a real function.

metze
2007-10-10 15:06:56 -05:00
Stefan Metzmacher
c0d095c8c9 r25211: fix compiler warning
metze
2007-10-10 15:06:54 -05:00
Stefan Metzmacher
780c1c776e r25209: unify logic of talloc_vasprintf_append() and talloc_vasprintf_append_buffer()
metze
2007-10-10 15:06:53 -05:00
Stefan Metzmacher
8532076720 r25208: add talloc_str[n]dup_append[_buffer]() functions
metze
2007-10-10 15:06:53 -05:00
Stefan Metzmacher
c2931540bc r25207: remove one nesting level and use unlikely()
metze
2007-10-10 15:06:53 -05:00
Stefan Metzmacher
92106e6b7e r25206: unify logic of talloc_strdup() and talloc_strndup(),
only strlen() vs. strnlen() is the difference now.

metze
2007-10-10 15:06:52 -05:00
Jeremy Allison
5bb8613b86 r25164: Add talloc_asprintf_append_buffer() and the docs for it.
Jeremy.
2007-10-10 15:06:44 -05:00
Jeremy Allison
948d32bb62 r25116: Fix talloc_asprintf_append to do the right thing with
truncated strings.
Jeremy.
2007-10-10 15:06:42 -05:00
Stefan Metzmacher
0216ff6daa r24626: as TALLOC_ABORT() is defined to abort() by default
wrap it into a function so that the function name
in the backtrace shows what happens.

metze
2007-10-10 15:02:26 -05:00
Andrew Tridgell
40c0919aaa r23798: updated old Temple Place FSF addresses to new URL 2007-10-10 14:59:15 -05:00
Andrew Tridgell
84b468b2f8 r23795: more v2->v3 conversion 2007-10-10 14:59:14 -05:00
Stefan Metzmacher
5cd100de82 r22758: - add missing _talloc_set_name_const(ret, ret); to talloc_append_string()
- update manpage and add comments about _talloc_set_name_const(ret, ret);
  in all places which use them

metze
2007-10-10 14:52:15 -05:00
Jeremy Allison
80706cf98d r22563: As tridge requested remove the _strict calls - for Samba3 I'm moving
to a separate file.
Jeremy.
2007-10-10 14:51:44 -05:00
Jeremy Allison
1ef269067c r22539: Added _strict varients of the talloc calls to
return NULL on size == 0 varients.
Jeremy.
2007-10-10 14:51:39 -05:00
Andrew Tridgell
21eb316473 r21174: many thanks to Paul Wayper for pointing out that C99 requires a
matching va_end() for each va_copy(). This doesn't matter for most
architectures, but there could be some obscure ones where it does
matter.

some of this should be ported to Samba3
2007-10-10 14:44:42 -05:00
Stefan Metzmacher
9d06a4b6e2 r20195: fix typo
metze
2007-10-10 14:29:21 -05:00
Stefan Metzmacher
ee47b40441 r20194: inline all static talloc functions
metze
2007-10-10 14:29:21 -05:00
Stefan Metzmacher
85fc18f047 r20193: - let talloc_parent_chunk() handle a NULL pointer
- use talloc_parent_chunk() in talloc_parent_name()
- add prototype of talloc_parent_name()

metze
2007-10-10 14:29:21 -05:00
Andrew Tridgell
8644708c3f r19412: some rather strange looking changes to talloc that gain us about 50%
in the talloc benchmark. These changes were driven by some cachegrind
profiles, with the biggest improvements coming from inlining some
functions.

I don't think it would be a good idea to start spreading inline and
likely()/unlikely() in other parts of Samba, as the benefit in most
code will be very small, but talloc() is such a speed critical part of
Samba that I think these changes are worthwhile
2007-10-10 14:21:29 -05:00
Simo Sorce
fe20ac404d r19304: If you really want to look at the contents undef this one 2007-10-10 14:21:05 -05:00
Stefan Metzmacher
2be48c1b03 r18995: - fix bug 4078
- talloc_free(talloc_autofree_context()); should not result
  in a SIGABORT on exit
- add a test for this, but this test can also pass in the standalone build
  and samba3, as samba4 uses talloc_autofree_context()

metze
2007-10-10 14:20:27 -05:00
Stefan Metzmacher
4505958224 r18946: fix compiler warning
metze
2007-10-10 14:20:23 -05:00
Andrew Tridgell
9b9f058edb r18521: implement volkers suggestion for avoiding the type punning warnings 2007-10-10 14:18:41 -05:00
Andrew Tridgell
200756017e r18435: added a function talloc_move() which is like talloc_steal(), but is
meant for moving pointers between structures. The difference is that
talloc_move() will zero the source pointer, thus ensuring you don't
reference the pointer in the old context.

talloc_move() is appropriate in some, but not all cases where we use
talloc_steal() now. The interface came out of a discussion with
Jeremy.
2007-10-10 14:18:29 -05:00
Andrew Tridgell
77d1a468e0 r18129: moved the system includes into libreplace - this gives much more
isolation of our portability environment from the main code, and also
simplifies the includes system (no separate #ifdef _SAMBA_BUILD for
tdb. ldb etc now)
2007-10-10 14:17:36 -05:00
Stefan Metzmacher
357882e6ec r18100: actually make usage of libreplace :-)
metze
2007-10-10 14:17:16 -05:00
Volker Lendecke
cd495d8931 r18027: Fix some 64-bit warnings 2007-10-10 14:17:04 -05:00
Stefan Metzmacher
5697841e29 r17950: sync talloc with samba3
metze
2007-10-10 14:16:56 -05:00
Stefan Metzmacher
b199557b35 r17907: - add a generic talloc_report_depth_cb() function which takes a callback
to do the actual report.
- make the talloc_report_depth_file() a wrapper of it
- and talloc_report() and talloc_report_full() are wrapper of
  talloc_report_depth_file()

metze
2007-10-10 14:16:54 -05:00
Stefan Metzmacher
933d1b47ad r17895: - talloc_increase_ref_count() can fail
- make talloc_reference() typesafe when gcc >= 3 is used

metze
2007-10-10 14:16:53 -05:00
Stefan Metzmacher
7cab4285b1 r17893: add a function to disable the null_context
metze
2007-10-10 14:16:52 -05:00
Stefan Metzmacher
6955ffe454 r17892: fix the last talloc c++ warning
metze
2007-10-10 14:16:52 -05:00
Stefan Metzmacher
fb73ce8d43 r17891: remove c++ warnings from talloc
metze
2007-10-10 14:16:52 -05:00
Andrew Tridgell
662f01f8ba r17578: in standalone talloc build ensure we get intptr_t if available (which
makes the discard_const stuff nicer)
2007-10-10 14:15:38 -05:00
Stefan Metzmacher
b091d182fe r17264: - remove unused includes from talloc
- check explicit check for varargs.h as fallback from stdarg.h
  and fail the build if both are not present

metze
2007-10-10 14:10:25 -05:00
Stefan Metzmacher
f47b7bb656 r17176: remove off_t from talloc. size_t is large enough to hold
the max amount of memory of one process

metze
2007-10-10 14:10:16 -05:00
Stefan Metzmacher
c5672a54a0 r17062: make correct use of talloc destructors, and make the code much simpler
should I merge that aslo to samba3?

metze
2007-10-10 14:10:10 -05:00
Stefan Metzmacher
0559222b62 r17061: - remove the currect talloc chunk from it's parent before freeing the children
this fixes an endless loop bug!
- reenable the test for this

should I merge this to samba3?

metze
2007-10-10 14:10:09 -05:00
Stefan Metzmacher
7aa07a1e0b r16446: talloc_set_name() allocates and can fail...
pass the error to the callers

metze
2007-10-10 14:09:15 -05:00
Andrew Tridgell
bba33a976b r15856: fixed talloc_asprintf_append() on solaris 2007-10-10 14:08:33 -05:00
Andrew Tridgell
babbff5f77 r15852: patch from Rusty to make talloc_set_destructor() and talloc_steal()
type safe. This only works on recent gcc versions. With other
compilers it reverts to a non-typesafe cast

The patch also ensures that talloc_free() does not change error on
systems where free() can change errno
2007-10-10 14:08:32 -05:00