aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-03-26 19:20:51 -0700
committerGuy Harris <guy@alum.mit.edu>2016-03-27 02:21:19 +0000
commitdd6a74894f5cac1c3b2a3706e1e2e219b3440c0c (patch)
treebb20249371caaccdd3ff6c1de0490c777c59ad03 /ui
parentf0ada20a91b2f8aeb785dfd121060af0442dd307 (diff)
Pull the invocation of the Lex scanner into common code.
Instead of text_import_setup() and text_import_cleanup() routines, and the actual scanner invocation being done in the dialog box, have a text_import() routine that does all the work. Change-Id: Ifd8a999618dbb411d613e6596484e4c2e013431d Reviewed-on: https://code.wireshark.org/review/14647 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/file_import_dlg.c8
-rw-r--r--ui/qt/import_text_dialog.cpp8
-rw-r--r--ui/text_import.c15
-rw-r--r--ui/text_import.h3
4 files changed, 9 insertions, 25 deletions
diff --git a/ui/gtk/file_import_dlg.c b/ui/gtk/file_import_dlg.c
index 3378d1beaf..83a16fb893 100644
--- a/ui/gtk/file_import_dlg.c
+++ b/ui/gtk/file_import_dlg.c
@@ -517,13 +517,7 @@ file_import_open(text_import_info_t *info)
goto end;
}
- text_import_setup(info);
-
- text_importin = info->import_text_file;
-
- text_importlex();
-
- text_import_cleanup();
+ text_import(info);
if (fclose(info->import_text_file)) {
read_failure_alert_box(info->import_text_filename, errno);
diff --git a/ui/qt/import_text_dialog.cpp b/ui/qt/import_text_dialog.cpp
index 6020bb9293..02479472ca 100644
--- a/ui/qt/import_text_dialog.cpp
+++ b/ui/qt/import_text_dialog.cpp
@@ -140,13 +140,7 @@ void ImportTextDialog::convertTextFile() {
return;
}
- text_import_setup(&import_info_);
-
- text_importin = import_info_.import_text_file;
-
- text_importlex();
-
- text_import_cleanup();
+ text_import(&import_info_);
if (fclose(import_info_.import_text_file))
{
diff --git a/ui/text_import.c b/ui/text_import.c
index f320eb5e42..9928ddbc1f 100644
--- a/ui/text_import.c
+++ b/ui/text_import.c
@@ -900,10 +900,10 @@ parse_token (token_t token, char *str)
}
/*----------------------------------------------------------------------
- * take in the import config information
+ * Import a text file.
*/
void
-text_import_setup(text_import_info_t *info)
+text_import(text_import_info_t *info)
{
packet_buf = (guint8 *)g_malloc(sizeof(HDR_ETHERNET) + sizeof(HDR_IP) +
sizeof(HDR_SCTP) + sizeof(HDR_DATA_CHUNK) +
@@ -1013,14 +1013,11 @@ text_import_setup(text_import_info_t *info)
}
max_offset = info->max_frame_length;
-}
-/*----------------------------------------------------------------------
- * Clean up after text import
- */
-void
-text_import_cleanup(void)
-{
+ text_importin = info->import_text_file;
+
+ text_importlex();
+
g_free(packet_buf);
}
diff --git a/ui/text_import.h b/ui/text_import.h
index 2fb8b608d9..e430205fda 100644
--- a/ui/text_import.h
+++ b/ui/text_import.h
@@ -86,8 +86,7 @@ typedef struct
guint max_frame_length;
} text_import_info_t;
-void text_import_setup(text_import_info_t *info);
-void text_import_cleanup(void);
+void text_import(text_import_info_t *info);
#ifdef __cplusplus
}