summaryrefslogtreecommitdiffstats
path: root/ta
Commit message (Collapse)AuthorAgeFilesLines
* ta: destroy/free children in reverse orderwm42019-09-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This matters when talloc allocations set destructors. Before this commit, destructors were called in the same order as they were added to the parent allocations. Now it happens in reverse order. I think this makes more sense. It's reasonable to assume that an allocation that was added later may depend on any of the previous allocations, so later additions should be destroyed first. (Of course other orders are entirely possible too.) Hopefully this doesn't fix or break anything, but I can't be sure (about either of those). It's risky. (Then why do it?) The destructor of a parent allocation is called before its children. It makes sense and must stay this way, because in most cases, the destructor wants to access the children. This is a reason why I don't really like talloc (it wasn't my idea to use talloc, is my excuse). Quite possible that destructors should be removed from talloc entirely. Actually, this project should probably be rewritten in Rust (or a better language), but that would be even more of a pain; also, I think this is just the right level of suffering and punishment.
* ta: introduce talloc_dup() and use it in some placeswm42018-01-182-2/+3
| | | | | | | It was actually already implemented as ta_dup_ptrtype(), but that seems like a clunky name. Also we still use the talloc_ names throughout the source, and I'd rather use an old name instead of a mixing inconsistent naming conventions.
* vo_gpu: vulkan: refactor vk_cmdpoolNiklas Haas2017-12-251-0/+7
| | | | | | 1. No more static arrays (deps / callbacks / queues / cmds) 2. Allows safely recording multiple commands at the same time 3. Uses resources optimally by never over-allocating commands
* Fix use of ISC licensewm42017-04-155-5/+15
| | | | | | | | | | The license text refers a "above copyright notice", so I guess it'd be good to actually provide such a notice. Add the license to some files that were missing it (since in theory, our Copyright file says that such files are LGPL by default). Remove the questionable remarks about the license in the client API.
* ta_talloc: add missing include statementwm42017-04-011-0/+2
| | | | Some array functions call memmove().
* ta: remove TA_FREEP NULL checkwm42017-01-081-1/+1
| | | | | | | | | | | The NULL check triggers a gcc warning when passing the address of a variable to it. I was about to silence the warning with some equivalent code (that just happens to shut up gcc), but then I decided to remove the NULL check as I don't see a reason why we should allow this. We don't use it in the existing code anyway (all callers do something like TA_FREEP(&structptr->member), which is always non-NULL). Also fix some of the macro argument "quoting".
* build: fix compilation with mingw-w64/ClangJames Ross-Gowan2016-11-171-1/+1
| | | | | | | | | | This fixes the build in mingw-w64/Clang on MSYS2. It also disables the use of gnu_printf in Clang, which was what was causing most of the warnings. The Clang-compiled mpv binary appears to work, but there are no guarantees yet, since until now mpv has only been tested with mingw-w64/GCC on Windows. Fixes #3800
* ta: add a helper macrowm42016-08-201-0/+4
|
* ta: remove old and redundant macrowm42016-05-171-2/+0
|
* ta: add TA_FREEP macroKevin Mitchell2016-03-301-0/+2
| | | | | This sets the pointer to NULL after talloc_freeing it. This emulates the av_freep function for ta_talloc, but with a macro instead.
* Initial Android supportJan Ekström2016-02-101-0/+1
| | | | | * Adds an 'android' feature, which is automatically detected. * Android has a broken strnlen, so a wrapper is added from FreeBSD.
* ta: add another array helper macrowm42015-06-011-0/+11
| | | | Stupid C.
* ta: memcpy(ptr, NULL, 0) is undefinedwm42015-03-231-1/+3
|
* ta: rename MP_TALLOC_ELEMS to MP_TALLOC_AVAILBen Boeckel2015-01-271-2/+2
| | | | | The macro actually returns the *available* space in the array, not how much is actually filled in.
* Remove some superfluous NULL checkswm42014-11-211-1/+1
| | | | | | | | In all of these situations, NULL is logically not allowed, making the checks redundant. Coverity complained about accessing the pointers before checking them for NULL later.
* ta/README: fix typoswm42014-10-131-2/+2
|
* talloc README: more human readible api referenceKevin Mitchell2014-04-131-1/+1
|
* ta: fix commentwm42014-02-231-1/+1
| | | | | | If this function could return the input value (i.e. the == case was correct), then macros like MP_GROW_ARRAY would have been incorrect. The implementation was correct though, so there's no bug.
* ta: clarify a corner casewm42014-02-231-0/+4
|
* ta: check overflow in array realloc macroswm42014-01-023-3/+18
|
* ta: fix compilation with NDEBUGwm42013-12-191-1/+2
|
* Merge mp_talloc.h into ta/ta_talloc.hwm42013-12-171-0/+38
|
* ta: fix typo in commentwm42013-11-201-1/+1
|
* ta: re-add MinGW cargo cultingwm42013-11-021-0/+6
| | | | | | | | Not really cargo cult, but an unexplainable, needless difference that just exists to annoy us. Fixes that gcc on MinGW treats format specifiers in MSVC mode. Just why? Why?
* ta: track location debug info in 2 more caseswm42013-10-301-0/+2
| | | | Was overlooked.
* Replace tallocwm42013-10-136-0/+1093
There are multiple reasons to do this. One big reason is the license: talloc is LGPLv3+, which forces mpv to be licensed as GPLv3+. Another one is that our talloc copy contains modifications, which makes it essentially incompatible with upstream talloc (in particular, our version aborts on out of memory conditions - well, it wasn't my idea). Updating from upstream is also a bit involved - the talloc source is not really organized in a way to allow copying it into projects (and this isn't an intended use-case). Finally, talloc is kind of big and bloated. The replacement halves the amount of code - mainly because we didn't use all talloc features. It's even more extreme if you compare upstream talloc (~4700 lines) and the new allocator without talloc compat (~900 lines). The replacement provides all features we need. It also doesn't clash with talloc. (The talloc compatibility wrapper uses macros to avoid introducing linker-level symbols which could clash with libtalloc.) It also tries to lower the overhead (only 4 words opposed to 10 words in talloc for leaf nodes in release mode). Debugging features like leak reporting can be enabled at compile time and add somewhat more overhead. Though I'm not sure whether the overhead reduction was actually successful: allocations with children need an "extra" header, which adds plenty of overhead, and it turns out that almost half of all allocations have children. Maybe the implementation could be simplified and the extra header removed - even then, overhead would be lower than talloc's. Currently, debugging features can be entirely deactivated by defining NDEBUG - I'm not sure if anything defines this directly yet, though. Unlike in talloc, the leak reporting stuff is thread-safe. (That's also why it's far less elegant, and requires extra list pointers.) Comes with a compatibility layer, so no changes to mpv source code are needed. The idea is that we will pretend to be using talloc for a while, so that we can revert to our old talloc implementation at any time for debugging purposes. Some inspiration was taken from Mesa's ralloc: http://cgit.freedesktop.org/mesa/mesa/tree/src/glsl/ralloc.h This is another talloc replacement, but lacks some features we need (getting size of an allocation, debugging features, being able to access children in the dtor). There's some information in ta/README what will happen next and how the transition is expected to progress.