Merge lp:~paul-mccullagh/drizzle/longjmp-clobbered-fix-2 into lp:~drizzle-trunk/drizzle/development

Proposed by Paul McCullagh
Status: Merged
Merged at revision: not available
Proposed branch: lp:~paul-mccullagh/drizzle/longjmp-clobbered-fix-2
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 83 lines (+20/-14)
2 files modified
plugin/pbxt/src/table_xt.cc (+19/-14)
plugin/pbxt/src/table_xt.h (+1/-0)
To merge this branch: bzr merge lp:~paul-mccullagh/drizzle/longjmp-clobbered-fix-2
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+24139@code.launchpad.net

Description of the change

This is a better fix for the error:

pbxt/src/table_xt.cc:580: warning: variable 'edx' might be clobbered by 'longjmp' or 'vfork'

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugin/pbxt/src/table_xt.cc'
2--- plugin/pbxt/src/table_xt.cc 2010-04-16 23:05:59 +0000
3+++ plugin/pbxt/src/table_xt.cc 2010-04-26 17:17:16 +0000
4@@ -683,25 +683,17 @@
5 * Previously we only caclulated statistics when a handler was opened
6 * and the underlying table was also opened.
7 */
8- /* This (hack) fixes: warning: variable 'edx' might be clobbered by 'longjmp' or 'vfork' */
9- u_int save_edx;
10+ XTTableHPtr tab;
11
12 xt_enum_tables_init(&edx);
13 while ((te_ptr = xt_enum_tables_next(self, db, &edx))) {
14- save_edx = edx;
15-
16 xt_strcpy(PATH_MAX, pbuf, te_ptr->te_tab_path->tp_path);
17 xt_add_dir_char(PATH_MAX, pbuf);
18 xt_strcat(PATH_MAX, pbuf, te_ptr->te_tab_name);
19- try_(a) {
20- edx = 0;
21- xt_heap_release(self, xt_use_table_no_lock(self, db, (XTPathStrPtr)pbuf, FALSE, FALSE, NULL));
22- } catch_(a) {
23- edx = 0;
24- /* ignore errors */
25+ if ((tab = xt_use_table_no_lock_ns(db, (XTPathStrPtr) pbuf, FALSE, FALSE, NULL)))
26+ xt_heap_release_ns(tab);
27+ else
28 xt_log_and_clear_warning(self);
29- } cont_(a);
30- edx = save_edx;
31 }
32
33 popr_(); // Discard xt_tab_exit_db(db)
34@@ -1472,7 +1464,6 @@
35 return_(XT_TAB_OK);
36 }
37
38-
39 /*
40 * Get a reference to a table in the current database. The table reference is valid,
41 * as long as the thread is using the database!!!
42@@ -1514,6 +1505,21 @@
43 return tab;
44 }
45
46+xtPublic XTTableHPtr xt_use_table_no_lock_ns(struct XTDatabase *db, XTPathStrPtr name, xtBool no_load, xtBool missing_ok, XTDictionaryPtr dic)
47+{
48+ XTTableHPtr tab;
49+ XTThreadPtr self = xt_get_self();
50+
51+ try_(a) {
52+ tab = xt_use_table_no_lock(self, db, name, no_load, missing_ok, dic);
53+ }
54+ catch_(a) {
55+ tab = NULL;
56+ }
57+ cont_(a);
58+ return tab;
59+}
60+
61 static void tab_close_table(XTOpenTablePtr ot)
62 {
63 xt_ind_free_reserved(ot);
64@@ -2954,7 +2960,6 @@
65 }
66 cont_(a);
67 return tab;
68-
69 }
70
71 /* The fixed part of the record is already in the row buffer.
72
73=== modified file 'plugin/pbxt/src/table_xt.h'
74--- plugin/pbxt/src/table_xt.h 2010-04-08 16:11:29 +0000
75+++ plugin/pbxt/src/table_xt.h 2010-04-26 17:17:16 +0000
76@@ -589,6 +589,7 @@
77 xtBool xt_flush_record_row(XTOpenTablePtr ot, off_t *bytes_flushed, xtBool have_table_loc);
78 void xt_flush_table(struct XTThread *self, XTOpenTablePtr ot);
79 XTTableHPtr xt_use_table_no_lock(XTThreadPtr self, struct XTDatabase *db, XTPathStrPtr name, xtBool no_load, xtBool missing_ok, XTDictionaryPtr dic);
80+XTTableHPtr xt_use_table_no_lock_ns(struct XTDatabase *db, XTPathStrPtr name, xtBool no_load, xtBool missing_ok, XTDictionaryPtr dic);
81 XTTableHPtr xt_use_table_by_id(XTThreadPtr self, struct XTDatabase *db, xtTableID tab_id, int *result);
82 XTTableHPtr xt_use_table_by_id_ns(struct XTDatabase *db, xtTableID tab_id);
83 XTOpenTablePtr xt_open_table(XTTableHPtr tab);