comparison src/lstream.c @ 8:4b173ad71786 r19-15b5

Import from CVS: tag r19-15b5
author cvs
date Mon, 13 Aug 2007 08:47:35 +0200
parents ac2d302a0011
children 0293115a14e9
comparison
equal deleted inserted replaced
7:c153ca296910 8:4b173ad71786
683 } 683 }
684 684
685 static int 685 static int
686 Lstream_pseudo_close (Lstream *lstr) 686 Lstream_pseudo_close (Lstream *lstr)
687 { 687 {
688 int rc;
689
688 if (!lstr->flags & LSTREAM_FL_IS_OPEN) 690 if (!lstr->flags & LSTREAM_FL_IS_OPEN)
689 { 691 {
690 Lisp_Object obj = Qnil; 692 Lisp_Object obj = Qnil;
691 XSETLSTREAM (obj, lstr); 693 XSETLSTREAM (obj, lstr);
692 signal_simple_internal_error 694 signal_simple_internal_error
693 ("Internal error: lstream is not open", obj); 695 ("Internal error: lstream is not open", obj);
694 } 696 }
695 697
696 /* don't check errors here -- best not to risk file descriptor loss */ 698 /* don't check errors here -- best not to risk file descriptor loss */
697 Lstream_flush (lstr); 699 rc = Lstream_flush (lstr);
698 700
699 return 0; 701 return rc;
700 } 702 }
701 703
702 int 704 int
703 Lstream_close (Lstream *lstr) 705 Lstream_close (Lstream *lstr)
704 { 706 {
707 int rc = 0;
708
705 if (lstr->flags & LSTREAM_FL_IS_OPEN) 709 if (lstr->flags & LSTREAM_FL_IS_OPEN)
706 { 710 {
707 /* don't return here on error, or file descriptor leak will result. */ 711 /* don't return here on error, or file descriptor leak will result. */
708 Lstream_pseudo_close (lstr); 712 rc = Lstream_pseudo_close (lstr);
709 if (lstr->imp->closer) 713 if (lstr->imp->closer)
710 { 714 {
711 if ((lstr->imp->closer) (lstr) < 0) 715 if ((lstr->imp->closer) (lstr) < 0)
712 return -1; 716 return -1;
713 } 717 }
736 { 740 {
737 xfree (lstr->unget_buffer); 741 xfree (lstr->unget_buffer);
738 lstr->unget_buffer = 0; 742 lstr->unget_buffer = 0;
739 } 743 }
740 744
741 return 0; 745 return rc;
742 } 746 }
743 747
744 int 748 int
745 Lstream_fputc (Lstream *lstr, int c) 749 Lstream_fputc (Lstream *lstr, int c)
746 { 750 {