/* Rewinds the filedescriptor to the current buffer position and blows the file read ahead buffer. This is useful for third party uses of the scanners filedescriptor, which hooks onto the current scanning position.  */
void g_scanner_sync_file_offset(GScanner *scanner)
/* Rewinds the filedescriptor to the current buffer position and blows the file read ahead buffer. This is useful for third party uses of the scanners filedescriptor, which hooks onto the current scanning position.  */
void g_scanner_sync_file_offset(GScanner *scanner)
{
  g_return_if_fail (scanner != NULL);
  if (scanner->input_fd >= 0 && scanner->text_end > scanner->text)
    {
      gint buffered;
      buffered = scanner->text_end - scanner->text;
      if (lseek (scanner->input_fd, - buffered, SEEK_CUR) >= 0)
	{
	  scanner->text = NULL;
	  scanner->text_end = NULL;
	}
      else
	errno = 0;
    }
}