summaryrefslogtreecommitdiff
path: root/ext/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-27 14:34:11 (GMT)
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-27 14:34:11 (GMT)
commitdb8dcd1b27064c5c9b203f311ff209c7051c8a7c (patch)
tree8fb74499bd3c0b751a97832d65dcc5e3f40f324b /ext/win32ole
parent1187cf0e0053dc957772884455b06c723daff60f (diff)
* ext/win32ole/win32ole.c (ole_variant2val): refactoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/win32ole')
-rw-r--r--ext/win32ole/win32ole.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index ac3c2a6..ac02b66 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -1574,16 +1574,14 @@ ole_variant2val(VARIANT *pvar)
case VT_BSTR:
{
- if(V_ISBYREF(pvar)) {
- obj = (SysStringLen(*V_BSTRREF(pvar)) == 0)
- ? rb_str_new2("")
- : ole_wc2vstr(*V_BSTRREF(pvar), FALSE);
- }
- else {
- obj = (SysStringLen(V_BSTR(pvar)) == 0)
- ? rb_str_new2("")
- : ole_wc2vstr(V_BSTR(pvar), FALSE);
- }
+ BSTR bstr;
+ if(V_ISBYREF(pvar))
+ bstr = *V_BSTRREF(pvar);
+ else
+ bstr = V_BSTR(pvar);
+ obj = (SysStringLen(bstr) == 0)
+ ? rb_str_new2("")
+ : ole_wc2vstr(bstr, FALSE);
break;
}