Blame nss/nss_parse_line_result.c

Packit Bot 2ee59f
/* Implementation of __nss_parse_line_result.
Packit Bot 2ee59f
   Copyright (C) 2020 Free Software Foundation, Inc.
Packit Bot 2ee59f
   This file is part of the GNU C Library.
Packit Bot 2ee59f
Packit Bot 2ee59f
   The GNU C Library is free software; you can redistribute it and/or
Packit Bot 2ee59f
   modify it under the terms of the GNU Lesser General Public
Packit Bot 2ee59f
   License as published by the Free Software Foundation; either
Packit Bot 2ee59f
   version 2.1 of the License, or (at your option) any later version.
Packit Bot 2ee59f
Packit Bot 2ee59f
   The GNU C Library is distributed in the hope that it will be useful,
Packit Bot 2ee59f
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Bot 2ee59f
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Bot 2ee59f
   Lesser General Public License for more details.
Packit Bot 2ee59f
Packit Bot 2ee59f
   You should have received a copy of the GNU Lesser General Public
Packit Bot 2ee59f
   License along with the GNU C Library; if not, see
Packit Bot 2ee59f
   <https://www.gnu.org/licenses/>.  */
Packit Bot 2ee59f
Packit Bot 2ee59f
#include <nss_files.h>
Packit Bot 2ee59f
Packit Bot 2ee59f
#include <assert.h>
Packit Bot 2ee59f
#include <errno.h>
Packit Bot 2ee59f
Packit Bot 2ee59f
int
Packit Bot 2ee59f
__nss_parse_line_result (FILE *fp, off64_t offset, int parse_line_result)
Packit Bot 2ee59f
{
Packit Bot 2ee59f
  assert (parse_line_result >= -1 && parse_line_result <= 1);
Packit Bot 2ee59f
Packit Bot 2ee59f
  switch (__builtin_expect (parse_line_result, 1))
Packit Bot 2ee59f
    {
Packit Bot 2ee59f
    case 1:
Packit Bot 2ee59f
      /* Sucess.  */
Packit Bot 2ee59f
      return 0;
Packit Bot 2ee59f
    case 0:
Packit Bot 2ee59f
      /* Parse error.  */
Packit Bot 2ee59f
      __set_errno (EINVAL);
Packit Bot 2ee59f
      return EINVAL;
Packit Bot 2ee59f
    case -1:
Packit Bot 2ee59f
      /* Out of buffer space.  */
Packit Bot 2ee59f
      return __nss_readline_seek (fp, offset);
Packit Bot 2ee59f
Packit Bot 2ee59f
      default:
Packit Bot 2ee59f
        __builtin_unreachable ();
Packit Bot 2ee59f
    }
Packit Bot 2ee59f
}
Packit Bot 2ee59f
libc_hidden_def (__nss_parse_line_result)