1. 13 9月, 2018 1 次提交
    • R
      fix issues from public functions defined without declaration visible · c221d3e5
      Rich Felker 提交于
      policy is that all public functions which have a public declaration
      should be defined in a context where that public declaration is
      visible, to avoid preventable type mismatches.
      
      an audit performed using GCC's -Wmissing-declarations turned up the
      violations corrected here. in some cases the public header had not
      been included; in others, a feature test macro needed to make the
      declaration visible had been omitted.
      
      in the case of gethostent and getnetent, the omission seems to have
      been intentional, as a hack to admit a single stub definition for both
      functions. this kind of hack is no longer acceptable; it's UB and
      would not fly with LTO or advanced toolchains. the hack is undone to
      make exposure of the declarations possible.
      c221d3e5
  2. 16 6月, 2015 1 次提交
    • R
      byte-based C locale, phase 2: stdio and iconv (multibyte callers) · 16f18d03
      Rich Felker 提交于
      this patch adjusts libc components which use the multibyte functions
      internally, and which depend on them operating in a particular
      encoding, to make the appropriate locale changes before calling them
      and restore the calling thread's locale afterwards. activating the
      byte-based C locale without these changes would cause regressions in
      stdio and iconv.
      
      in the case of iconv, the current implementation was simply using the
      multibyte functions as UTF-8 conversions. setting a multibyte UTF-8
      locale for the duration of the iconv operation allows the code to
      continue working.
      
      in the case of stdio, POSIX requires that FILE streams have an
      encoding rule bound at the time of setting wide orientation. as long
      as all locales, including the C locale, used the same encoding,
      treating high bytes as UTF-8, there was no need to store an encoding
      rule as part of the stream's state.
      
      a new locale field in the FILE structure points to the locale that
      should be made active during fgetwc/fputwc/ungetwc on the stream. it
      cannot point to the locale active at the time the stream becomes
      oriented, because this locale could be mutable (the global locale) or
      could be destroyed (locale_t objects produced by newlocale) before the
      stream is closed. instead, a pointer to the static C or C.UTF-8 locale
      object added in commit commit aeeac9ca
      is used. this is valid since categories other than LC_CTYPE will not
      affect these functions.
      16f18d03
  3. 02 7月, 2014 1 次提交
    • R
      fix incorrect return value for fwide function · ebd8142a
      Rich Felker 提交于
      when the orientation of the stream was already set, fwide was
      incorrectly returning its argument (the requested orientation) rather
      than the actual orientation of the stream.
      ebd8142a
  4. 12 12月, 2013 1 次提交
  5. 25 10月, 2012 1 次提交
    • R
      correct locking in stdio functions that tried to be lock-free · c8cb6bcd
      Rich Felker 提交于
      these functions must behave as if they obtain the lock via flockfile
      to satisfy POSIX requirements. since another thread can provably hold
      the lock when they are called, they must wait to obtain the lock
      before they can return, even if the correct return value could be
      obtained without locking. in the case of fclose and freopen, failure
      to do so could cause correct (albeit obscure) programs to crash or
      otherwise misbehave; in the case of feof, ferror, and fwide, failure
      to obtain the lock could sometimes return incorrect results. in any
      case, having these functions proceed and return while another thread
      held the lock was wrong.
      c8cb6bcd
  6. 12 2月, 2011 1 次提交