aboutsummaryrefslogtreecommitdiffstats
path: root/epan/uat.c
diff options
context:
space:
mode:
authorlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>2007-02-04 05:19:02 +0000
committerlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>2007-02-04 05:19:02 +0000
commitd5c959a3706dabcdf1ada873abc8a9471d9ebf97 (patch)
tree0bbf757971d9e67cec739b1f30fb96bef8f270be /epan/uat.c
parentec7924944f0ccaaf3ef4339bd8168faa2e33a0cd (diff)
Move (Up/Down) & Save buttons
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20708 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/uat.c')
-rw-r--r--epan/uat.c17
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;
}