Mesa (glsl2): glsl2: Remove uses of deprecated TALLOC_CTX type.

Kenneth Graunke kwg at kemper.freedesktop.org
Wed Aug 4 22:56:02 UTC 2010


Module: Mesa
Branch: glsl2
Commit: ad98aa9d93646600cc95b3e45a40eec26f18988a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad98aa9d93646600cc95b3e45a40eec26f18988a

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Aug  3 20:05:53 2010 -0700

glsl2: Remove uses of deprecated TALLOC_CTX type.

---

 src/glsl/ast_function.cpp |   12 ++++++------
 src/glsl/glsl_types.cpp   |   26 +++++++++++++-------------
 src/glsl/glsl_types.h     |   12 ++++++------
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index 661f8f6..c22dfa8 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -629,20 +629,20 @@ emit_inline_vector_constructor(const glsl_type *type,
 ir_instruction *
 assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base,
 			ir_rvalue *src, unsigned src_base, unsigned count,
-			TALLOC_CTX *ctx)
+			void *mem_ctx)
 {
    const unsigned mask[8] = { 0, 1, 2, 3, 0, 0, 0, 0 };
 
-   ir_constant *col_idx = new(ctx) ir_constant(column);
-   ir_rvalue *column_ref = new(ctx) ir_dereference_array(var, col_idx);
+   ir_constant *col_idx = new(mem_ctx) ir_constant(column);
+   ir_rvalue *column_ref = new(mem_ctx) ir_dereference_array(var, col_idx);
 
    assert(column_ref->type->components() >= (row_base + count));
-   ir_rvalue *lhs = new(ctx) ir_swizzle(column_ref, &mask[row_base], count);
+   ir_rvalue *lhs = new(mem_ctx) ir_swizzle(column_ref, &mask[row_base], count);
 
    assert(src->type->components() >= (src_base + count));
-   ir_rvalue *rhs = new(ctx) ir_swizzle(src, &mask[src_base], count);
+   ir_rvalue *rhs = new(mem_ctx) ir_swizzle(src, &mask[src_base], count);
 
-   return new(ctx) ir_assignment(lhs, rhs, NULL);
+   return new(mem_ctx) ir_assignment(lhs, rhs, NULL);
 }
 
 
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 40a5b6c..88f305a 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -33,14 +33,14 @@ extern "C" {
 
 hash_table *glsl_type::array_types = NULL;
 hash_table *glsl_type::record_types = NULL;
-void *glsl_type::ctx = NULL;
+void *glsl_type::mem_ctx = NULL;
 
 void
 glsl_type::init_talloc_type_ctx(void)
 {
-   if (glsl_type::ctx == NULL) {
-      glsl_type::ctx = talloc_init("glsl_type");
-      assert(glsl_type::ctx != NULL);
+   if (glsl_type::mem_ctx == NULL) {
+      glsl_type::mem_ctx = talloc_init("glsl_type");
+      assert(glsl_type::mem_ctx != NULL);
    }
 }
 
@@ -55,7 +55,7 @@ glsl_type::glsl_type(GLenum gl_type,
    length(0)
 {
    init_talloc_type_ctx();
-   this->name = talloc_strdup(this->ctx, name);
+   this->name = talloc_strdup(this->mem_ctx, name);
    /* Neither dimension is zero or both dimensions are zero.
     */
    assert((vector_elements == 0) == (matrix_columns == 0));
@@ -73,7 +73,7 @@ glsl_type::glsl_type(GLenum gl_type,
    length(0)
 {
    init_talloc_type_ctx();
-   this->name = talloc_strdup(this->ctx, name);
+   this->name = talloc_strdup(this->mem_ctx, name);
    memset(& fields, 0, sizeof(fields));
 }
 
@@ -88,8 +88,8 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
    unsigned int i;
 
    init_talloc_type_ctx();
-   this->name = talloc_strdup(this->ctx, name);
-   this->fields.structure = talloc_array(this->ctx,
+   this->name = talloc_strdup(this->mem_ctx, name);
+   this->fields.structure = talloc_array(this->mem_ctx,
 					 glsl_struct_field, length);
    for (i = 0; i < length; i++) {
       this->fields.structure[i].type = fields[i].type;
@@ -228,9 +228,9 @@ _mesa_glsl_release_types(void)
       glsl_type::record_types = NULL;
    }
 
-   if (glsl_type::ctx != NULL) {
-      talloc_free(glsl_type::ctx);
-      glsl_type::ctx = NULL;
+   if (glsl_type::mem_ctx != NULL) {
+      talloc_free(glsl_type::mem_ctx);
+      glsl_type::mem_ctx = NULL;
    }
 }
 
@@ -315,7 +315,7 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) :
     * NUL.
     */
    const unsigned name_length = strlen(array->name) + 10 + 3;
-   char *const n = (char *) talloc_size(this->ctx, name_length);
+   char *const n = (char *) talloc_size(this->mem_ctx, name_length);
 
    if (length == 0)
       snprintf(n, name_length, "%s[]", array->name);
@@ -405,7 +405,7 @@ glsl_type::get_array_instance(const glsl_type *base, unsigned array_size)
    if (t == NULL) {
       t = new glsl_type(base, array_size);
 
-      hash_table_insert(array_types, (void *) t, talloc_strdup(ctx, key));
+      hash_table_insert(array_types, (void *) t, talloc_strdup(mem_ctx, key));
    }
 
    assert(t->base_type == GLSL_TYPE_ARRAY);
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index c3f81b8..97d0d98 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -76,17 +76,17 @@ struct glsl_type {
 				*/
 
    /* Callers of this talloc-based new need not call delete. It's
-    * easier to just talloc_free 'ctx' (or any of its ancestors). */
+    * easier to just talloc_free 'mem_ctx' (or any of its ancestors). */
    static void* operator new(size_t size)
    {
-      if (glsl_type::ctx == NULL) {
-	 glsl_type::ctx = talloc_init("glsl_type");
-	 assert(glsl_type::ctx != NULL);
+      if (glsl_type::mem_ctx == NULL) {
+	 glsl_type::mem_ctx = talloc_init("glsl_type");
+	 assert(glsl_type::mem_ctx != NULL);
       }
 
       void *type;
 
-      type = talloc_size(glsl_type::ctx, size);
+      type = talloc_size(glsl_type::mem_ctx, size);
       assert(type != NULL);
 
       return type;
@@ -394,7 +394,7 @@ private:
     *
     * Set on the first call to \c glsl_type::new.
     */
-   static TALLOC_CTX *ctx;
+   static void *mem_ctx;
 
    void init_talloc_type_ctx(void);
 




More information about the mesa-commit mailing list