summaryrefslogtreecommitdiffstats
path: root/src/glsl/ralloc.c
Commit message (Collapse)AuthorAgeFilesLines
* ralloc: Move declarations before statements.José Fonseca2013-04-181-2/+4
| | | | Trivial. Should fix MSVC build.
* ralloc: don't write to memory in case of alloc fail.Dave Airlie2013-04-181-0/+2
| | | | | | | | | | | For some reason I made this happen under indirect rendering, I think we might have a leak, valgrind gave out, so I said I'd fix the basic problem. NOTE: This is a candidate for stable branches. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* ralloc: Annotate printf functions with PRINTFLIKE(...)Matt Turner2012-10-251-8/+0
| | | | | | | | | | | | | | | Catches problems such as (in the gles3 branch) glcpp-parse.y: In function '_glcpp_parser_handle_version_declaration': glcpp-parse.y:1990:39: warning: format '%lli' expects argument of type 'long long int', but argument 4 has type 'int' [-Wformat] As a side-effect, remove ralloc.c's likely/unlikely macros and just use the ones from main/compiler.h. NOTE: This is a candidate for the release branches. Reviewed-by: Ian Romanick <[email protected]>
* ralloc: Fix ralloc_parent() of memory allocated out of the NULL context.Kenneth Graunke2012-05-301-1/+1
| | | | | | | | | | | | If an object is allocated out of the NULL context, info->parent will be NULL. Using the PTR_FROM_HEADER macro would be incorrect: it would say that ralloc_parent(ralloc_context(NULL)) == sizeof(ralloc_header). Fixes the new "null_parent" unit test. NOTE: This is a candidate for the 7.9, 7.10, 7.11, and 8.0 branches. Signed-off-by: Kenneth Graunke <[email protected]>
* ralloc: Make rewrite_tail increase "start" by the new text's length.Kenneth Graunke2012-02-281-5/+6
| | | | | | | | | | | | | | | | | | Both callers of rewrite_tail immediately compute the new total string length by adding the (known) length of the existing string plus the length of the newly appended text. Unfortunately, callers generally won't know the length of the new text, as it's printf-formatted. Since ralloc already computes this length, it makes sense to add it in and save the caller the effort. This simplifies both existing callers, but more importantly, will allow for cheap-appending in the next commit. v2: The link_uniforms code needs both the old and new length. Apply the obvious fix (which sadly makes it less of a cleanup). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> [v1] Acked-by: José Fonseca <[email protected]> [v1]
* ralloc: Use _vscprintf on MinGW.José Fonseca2011-11-011-1/+7
| | | | | | | | MinGW uses MSVC's runtime DLLs for most of C runtime's functions, and there has same semantics for vsnprintf. Not sure how this worked until now -- maybe one of the internal vsnprintf implementations was taking precedence.
* ralloc: Move declaration before code.Vinson Lee2011-10-251-1/+2
| | | | Fixes build error with MSVC.
* ralloc: Add new [v]asprintf_rewrite_tail functions.Kenneth Graunke2011-10-251-4/+23
| | | | | | | | | | | | | | | | | | This can be useful if you want to create a bunch of temporary strings with a common prefix. For example, when iterating over uniform structure fields, one might want to create temporary strings like "pallete.primary", "palette.outline", and "pallette.shadow". This could be done by overwriting the '.' with a null-byte and calling ralloc_asprintf_append, but that incurs the cost of strlen("pallete") every time...when this is already known. These new functions allow you rewrite the tail of the string, given a starting index. If the starting index is the length of the string, this is equivalent to appending. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* ralloc: include limits.h for SIZE_MAX on AndroidChia-I Wu2011-08-211-0/+5
| | | | | | | Android does not define SIZE_MAX in stdint.h. We have to include limits.h for it. Reviewed-by: Chad Versace <[email protected]>
* ralloc: Add missing va_end following va_copy.Vinson Lee2011-02-031-0/+2
|
* glsl: Fix printf_length() on MSVC.José Fonseca2011-02-011-0/+8
|
* glsl: Define va_copy on MSVC.José Fonseca2011-01-311-0/+8
|
* ralloc: a new MIT-licensed recursive memory allocator.Kenneth Graunke2011-01-311-34/+272
|
* ralloc: Add a fake implementation of ralloc based on talloc.Kenneth Graunke2011-01-311-0/+202