gallium/hud: move file initialization to a function
[mesa.git] / src / gallium / auxiliary / hud / hud_driver_query.c
index 23fda0187dd412ab3f1a3a8d0fd6a9d268cb2bc7..d80b8eda60c65e443f1c4f89b589b8c484d3f62f 100644 (file)
@@ -351,8 +351,6 @@ hud_pipe_query_install(struct hud_batch_query_context **pbq,
 {
    struct hud_graph *gr;
    struct query_info *info;
-   const char *hud_dump_dir = getenv("GALLIUM_HUD_DUMP_DIR");
-   char *dump_file;
 
    gr = CALLOC_STRUCT(hud_graph);
    if (!gr)
@@ -380,15 +378,7 @@ hud_pipe_query_install(struct hud_batch_query_context **pbq,
       info->result_index = result_index;
    }
 
-   if (hud_dump_dir && access(hud_dump_dir, W_OK) == 0) {
-      dump_file = malloc(strlen(hud_dump_dir) + sizeof(gr->name));
-      if (dump_file) {
-         strcpy(dump_file, hud_dump_dir);
-         strcat(dump_file, gr->name);
-         gr->fd = fopen(dump_file, "w+");
-         free(dump_file);
-      }
-   }
+   hud_graph_set_dump_file(gr);
 
    hud_pane_add_graph(pane, gr);
    pane->type = type; /* must be set before updating the max_value */