diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-12-05 21:45:28 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-12-05 21:50:40 +0000 |
commit | 540272705790811627f15a787d094f5a57f67d92 (patch) | |
tree | 4664f63eeeecf44f9a38bfdbfa884c269031e586 /src/app.c | |
parent | 653848770d2e975ce418028cce72b4e36cb183de (diff) |
Store the array of Frames in the Allocator (rather than 3 arrays).
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 40 |
1 files changed, 16 insertions, 24 deletions
@@ -307,20 +307,16 @@ read_allocator (App *app, int fd, guint time) if (! readn (fd, &A->n_frames, sizeof (A->n_frames))) return NULL; - A->ips = client_perm_alloc (&app->client, - sizeof (gulong) * A->n_frames + - sizeof (const gchar *) * 2 * A->n_frames); - A->functions = (const gchar **) (A->ips + A->n_frames); - A->functions_srcloc = A->functions + A->n_frames; + A->frames = client_perm_alloc (&app->client, + sizeof (Frame *) * A->n_frames); - if (! readn (fd, A->ips, A->n_frames * sizeof (gulong))) + if (! readn (fd, A->frames, A->n_frames * sizeof (gulong))) return NULL; for (n = 0; n < A->n_frames; n++) { - Frame *frame = frames_get (&app->client.frames, A->ips[n]); - g_return_val_if_fail (frame != NULL, NULL); - A->functions[n] = frame->function; - A->functions_srcloc[n] = frame->function_srcloc; + A->frames[n] = frames_get (&app->client.frames, + ((gulong *) A->frames)[n]); + g_return_val_if_fail (A->frames[n] != NULL, NULL); } A->alloc_fn_serial = 0; @@ -622,11 +618,11 @@ _client_update_alloc_fn (Client *client) break; for (n = 0; n < A->n_frames - 1; n++) { - if (! frames_is_alloc_fn (&client->frames, A->ips[n])) + if (! frames_is_alloc_fn (&client->frames, A->frames[n])) break; } - A->alloc_fn = A->functions[n]; + A->alloc_fn = A->frames[n]->function; A->alloc_fn_serial = serial; } } @@ -1581,20 +1577,16 @@ lwp_read (GIOChannel *io, App *app) if (! readn (fd, &A->n_frames, sizeof (A->n_frames))) return FALSE; - A->ips = client_perm_alloc (&app->client, - sizeof (gulong) * A->n_frames + - sizeof (const gchar *) * 2 * A->n_frames); - A->functions = (const gchar **) (A->ips + A->n_frames); - A->functions_srcloc = A->functions + A->n_frames; + A->frames = client_perm_alloc (&app->client, + sizeof (Frame *) * A->n_frames); - if (! readn (fd, A->ips, A->n_frames * sizeof (gulong))) + if (! readn (fd, A->frames, A->n_frames * sizeof (gulong))) return FALSE; for (n = 0; n < A->n_frames; n++) { - Frame *frame = frames_get (&app->client.frames, A->ips[n]); - g_return_val_if_fail (frame != NULL, FALSE); - A->functions[n] = frame->function; - A->functions_srcloc[n] = frame->function_srcloc; + A->frames[n] = frames_get (&app->client.frames, + ((gulong *)A->frames)[n]); + g_return_val_if_fail (A->frames[n] != NULL, FALSE); } A->alloc_fn_serial = 0; @@ -1838,9 +1830,9 @@ vg_log_server_cb (GIOChannel *source, } gboolean -app_is_alloc_fn (App *app, gulong ip) +app_is_alloc_fn (App *app, Frame *f) { - return frames_is_alloc_fn (&app->client.frames, ip); + return frames_is_alloc_fn (&app->client.frames, f); } gboolean |