diff options
author | Don Anderson <dda@ddanderson.com> | 2011-04-14 13:52:27 -0400 |
---|---|---|
committer | Don Anderson <dda@ddanderson.com> | 2011-04-14 13:52:27 -0400 |
commit | 1fa496195967c0360c66a7c190508e0233ec3448 (patch) | |
tree | 696101444681e5fc3c581a87d47b8fa69a432570 /lang | |
parent | 5a70018b4550fc81e9ce5c75384bd5976d74cbb0 (diff) | |
download | mongo-1fa496195967c0360c66a7c190508e0233ec3448.tar.gz |
Turned 3 typemaps for self elimination into a single macro - (from mjc)
Fixed error I made in local merge of wiredtiger.in
refs #31
--HG--
extra : rebase_source : 44278684b451925d6a9c53c955d7bed04ed0d6f2
Diffstat (limited to 'lang')
-rw-r--r-- | lang/python/wiredtiger.i | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/lang/python/wiredtiger.i b/lang/python/wiredtiger.i index 7b0af55a39c..4f04c3a1d61 100644 --- a/lang/python/wiredtiger.i +++ b/lang/python/wiredtiger.i @@ -48,30 +48,20 @@ * int method(wt_xxx *self, WT_XXX *, ...otherargs...); * and we use consecutive argument matching of typemaps to convert two args to one. */ -%typemap(in) (struct wt_connection *self, WT_CONNECTION *) (void *argp = 0, int res = 0) %{ - res = SWIG_ConvertPtr($input, &argp, $descriptor, $disown | 0); - if (!SWIG_IsOK(res)) { - SWIG_exception_fail(SWIG_ArgError(res), "in method '" "$symname" "', argument " "$argnum" " of type '" "$type" "'"); - } - $2 = $1 = ($ltype)(argp); -%} - -%typemap(in) (struct wt_session *self, WT_SESSION *) (void *argp = 0, int res = 0) %{ - res = SWIG_ConvertPtr($input, &argp, $descriptor, $disown | 0); - if (!SWIG_IsOK(res)) { - SWIG_exception_fail(SWIG_ArgError(res), "in method '" "$symname" "', argument " "$argnum" " of type '" "$type" "'"); - } - $2 = $1 = ($ltype)(argp); -%} - -%typemap(in) (struct wt_cursor *self, WT_CURSOR *) (void *argp = 0, int res = 0) %{ +%define SELFHELPER(type) +%typemap(in) (type *self, type *) (void *argp = 0, int res = 0) %{ res = SWIG_ConvertPtr($input, &argp, $descriptor, $disown | 0); if (!SWIG_IsOK(res)) { SWIG_exception_fail(SWIG_ArgError(res), "in method '" "$symname" "', argument " "$argnum" " of type '" "$type" "'"); } $2 = $1 = ($ltype)(argp); %} +%enddef +SELFHELPER(struct wt_connection) +SELFHELPER(struct wt_session) +SELFHELPER(struct wt_cursor) + /* WT_CURSOR customization. * We want our own 'next' function for wt_cursor, so we can * implement iterable. Since nobody but use will use |