@@ -287,9 +287,10 @@ private:
287
287
_LIBCPP_EXPORTED_FROM_ABI friend FILE* __get_ostream_file (ostream&);
288
288
289
289
// There are multiple (__)open function, they use different C-API open
290
- // function. After that call these functions behave the same. This function
290
+ // function. After that call these functions behave the same. This function
291
291
// does that part and determines the final return value.
292
- _LIBCPP_HIDE_FROM_ABI basic_filebuf* __open_common_part (ios_base::openmode __mode) {
292
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf* __do_open (FILE* __file, ios_base::openmode __mode) {
293
+ __file_ = __file;
293
294
if (!__file_)
294
295
return nullptr ;
295
296
@@ -599,8 +600,7 @@ basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const char*
599
600
if (!__mdstr)
600
601
return nullptr ;
601
602
602
- __file_ = fopen (__s, __mdstr);
603
- return __open_common_part (__mode);
603
+ return __do_open (fopen (__s, __mdstr), __mode);
604
604
}
605
605
606
606
template <class _CharT , class _Traits >
@@ -611,8 +611,7 @@ inline basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::__open(in
611
611
if (!__mdstr)
612
612
return nullptr ;
613
613
614
- __file_ = fdopen (__fd, __mdstr);
615
- return __open_common_part (__mode);
614
+ return __do_open (fdopen (__fd, __mdstr), __mode);
616
615
}
617
616
618
617
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
@@ -626,8 +625,7 @@ basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const wchar
626
625
if (!__mdstr)
627
626
return nullptr ;
628
627
629
- __file_ = _wfopen (__s, __mdstr);
630
- return __open_common_part (__mode);
628
+ return __do_open (_wfopen (__s, __mdstr), __mode);
631
629
}
632
630
# endif
633
631
0 commit comments