diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2007-02-04 05:19:02 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2007-02-04 05:19:02 +0000 |
commit | fbc8912b871570db26c0bded27b73715016e7088 (patch) | |
tree | 0bbf757971d9e67cec739b1f30fb96bef8f270be /epan/uat.c | |
parent | 96f517647a8f8b22c66eacf6e3d8bea9d8b8c68f (diff) |
Move (Up/Down) & Save buttons
svn path=/trunk/; revision=20708
Diffstat (limited to 'epan/uat.c')
-rw-r--r-- | epan/uat.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/epan/uat.c b/epan/uat.c index a8113aded4..133c466d97 100644 --- a/epan/uat.c +++ b/epan/uat.c @@ -80,6 +80,7 @@ uat_t* uat_new(const char* name, uat->free_cb = free_cb; uat->fields = flds_array; uat->user_data = g_array_new(FALSE,FALSE,uat->record_size); + uat->changed = FALSE; uat->rep = NULL; uat->free_rep = NULL; @@ -118,6 +119,20 @@ void* uat_add_record(uat_t* uat, const void* data) { return rec; } +void uat_swap(uat_t* uat, guint a, guint b) { + guint s = uat->record_size; + void* tmp = ep_alloc(s); + + g_assert( a < uat->user_data->len && b < uat->user_data->len ); + + if (a == b) return; + + memcpy(tmp, UAT_INDEX_PTR(uat,a), s); + memcpy(UAT_INDEX_PTR(uat,a), UAT_INDEX_PTR(uat,b), s); + memcpy(UAT_INDEX_PTR(uat,b), tmp, s); + +} + void uat_remove_record_idx(uat_t* uat, guint idx) { g_assert( idx < uat->user_data->len ); @@ -224,6 +239,8 @@ gboolean uat_save(uat_t* uat, char** error) { fclose(fp); + uat->changed = FALSE; + return TRUE; } |