Subversion Repositories Kolibri OS

Rev

Rev 4874 | Rev 6099 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4874 Rev 4921
Line 176... Line 176...
176
	&& (defined __GNUC__ || __STDC_VERSION__ >= 199901L)
176
	&& (defined __GNUC__ || __STDC_VERSION__ >= 199901L)
177
# undef _NO_LONGLONG
177
# undef _NO_LONGLONG
178
#endif
178
#endif
Line 179... Line 179...
179
 
179
 
-
 
180
#ifdef STRING_ONLY
180
#ifdef STRING_ONLY
181
# ifdef _FVWRITE_IN_STREAMIO
181
#define __SPRINT __ssprint_r
182
#  define __SPRINT __ssprint_r
-
 
183
# else
-
 
184
#  define __SPRINT __ssputs_r
-
 
185
# endif
-
 
186
#else
182
#else
187
# ifdef _FVWRITE_IN_STREAMIO
-
 
188
#  define __SPRINT __sprint_r
-
 
189
# else
-
 
190
#  define __SPRINT __sfputs_r
183
#define __SPRINT __sprint_r
191
# endif
Line 184... Line 192...
184
#endif
192
#endif
185
 
193
 
186
/* The __sprint_r/__ssprint_r functions are shared between all versions of
194
/* The __sprint_r/__ssprint_r functions are shared between all versions of
187
   vfprintf and vfwprintf.  They must only be defined once, which we do in
195
   vfprintf and vfwprintf.  They must only be defined once, which we do in
188
   the INTEGER_ONLY versions here. */
196
   the INTEGER_ONLY versions here. */
-
 
197
#ifdef STRING_ONLY
-
 
198
#ifdef INTEGER_ONLY
-
 
199
#ifndef _FVWRITE_IN_STREAMIO
-
 
200
int
-
 
201
_DEFUN(__ssputs_r, (ptr, fp, buf, len),
-
 
202
       struct _reent *ptr _AND
-
 
203
       FILE *fp _AND
-
 
204
       _CONST char *buf _AND
-
 
205
       size_t len)
-
 
206
{
-
 
207
	register int w;
-
 
208
 
-
 
209
	w = fp->_w;
-
 
210
	if (len >= w && fp->_flags & (__SMBF | __SOPT)) {
-
 
211
		/* must be asprintf family */
-
 
212
		unsigned char *str;
-
 
213
		int curpos = (fp->_p - fp->_bf._base);
-
 
214
		/* Choose a geometric growth factor to avoid
-
 
215
	 	 * quadratic realloc behavior, but use a rate less
-
 
216
		 * than (1+sqrt(5))/2 to accomodate malloc
-
 
217
	 	 * overhead. asprintf EXPECTS us to overallocate, so
-
 
218
	 	 * that it can add a trailing \0 without
-
 
219
	 	 * reallocating.  The new allocation should thus be
-
 
220
	 	 * max(prev_size*1.5, curpos+len+1). */
-
 
221
		int newsize = fp->_bf._size * 3 / 2;
-
 
222
		if (newsize < curpos + len + 1)
-
 
223
			newsize = curpos + len + 1;
-
 
224
		if (fp->_flags & __SOPT)
-
 
225
		{
-
 
226
			/* asnprintf leaves original buffer alone.  */
-
 
227
			str = (unsigned char *)_malloc_r (ptr, newsize);
-
 
228
			if (!str)
-
 
229
			{
-
 
230
				ptr->_errno = ENOMEM;
-
 
231
				goto err;
-
 
232
			}
-
 
233
			memcpy (str, fp->_bf._base, curpos);
-
 
234
			fp->_flags = (fp->_flags & ~__SOPT) | __SMBF;
-
 
235
		}
-
 
236
		else
-
 
237
		{
-
 
238
			str = (unsigned char *)_realloc_r (ptr, fp->_bf._base,
-
 
239
					newsize);
-
 
240
			if (!str) {
-
 
241
				/* Free unneeded buffer.  */
-
 
242
				_free_r (ptr, fp->_bf._base);
-
 
243
				/* Ensure correct errno, even if free
-
 
244
				 * changed it.  */
-
 
245
				ptr->_errno = ENOMEM;
-
 
246
				goto err;
-
 
247
			}
-
 
248
		}
-
 
249
		fp->_bf._base = str;
-
 
250
		fp->_p = str + curpos;
-
 
251
		fp->_bf._size = newsize;
-
 
252
		w = len;
-
 
253
		fp->_w = newsize - curpos;
-
 
254
	}
-
 
255
	if (len < w)
-
 
256
		w = len;
-
 
257
	(void)memmove ((_PTR) fp->_p, (_PTR) buf, (size_t) (w));
-
 
258
	fp->_w -= w;
-
 
259
	fp->_p += w;
-
 
260
 
-
 
261
	return 0;
-
 
262
 
-
 
263
err:
-
 
264
	fp->_flags |= __SERR;
-
 
265
	return EOF;
-
 
266
}
189
#ifdef STRING_ONLY
267
#endif
190
#ifdef INTEGER_ONLY
268
 
191
int
269
int
192
_DEFUN(__ssprint_r, (ptr, fp, uio),
270
_DEFUN(__ssprint_r, (ptr, fp, uio),
193
       struct _reent *ptr _AND
271
       struct _reent *ptr _AND
Line 278... Line 356...
278
  uio->uio_resid = 0;
356
  uio->uio_resid = 0;
279
  uio->uio_iovcnt = 0;
357
  uio->uio_iovcnt = 0;
280
  return EOF;
358
  return EOF;
281
}
359
}
282
#else /* !INTEGER_ONLY */
360
#else /* !INTEGER_ONLY */
-
 
361
#ifndef _FVWRITE_IN_STREAMIO
-
 
362
int __ssputs_r (struct _reent *, FILE *, _CONST char *, size_t);
-
 
363
#endif
283
int __ssprint_r (struct _reent *, FILE *, register struct __suio *);
364
int __ssprint_r (struct _reent *, FILE *, register struct __suio *);
284
#endif /* !INTEGER_ONLY */
365
#endif /* !INTEGER_ONLY */
Line 285... Line 366...
285
 
366
 
286
#else /* !STRING_ONLY */
367
#else /* !STRING_ONLY */
-
 
368
#ifdef INTEGER_ONLY
-
 
369
 
-
 
370
#ifndef _FVWRITE_IN_STREAMIO
-
 
371
int
-
 
372
_DEFUN(__sfputs_r, (ptr, fp, buf, len),
-
 
373
       struct _reent *ptr _AND
-
 
374
       FILE *fp _AND
-
 
375
       _CONST char *buf _AND
-
 
376
       size_t len)
-
 
377
{
-
 
378
	register int i;
-
 
379
 
-
 
380
#ifdef _WIDE_ORIENT
-
 
381
	if (fp->_flags2 & __SWID) {
-
 
382
		wchar_t *p;
-
 
383
 
-
 
384
		p = (wchar_t *) buf;
-
 
385
		for (i = 0; i < (len / sizeof (wchar_t)); i++) {
-
 
386
			if (_fputwc_r (ptr, p[i], fp) == WEOF)
-
 
387
				return -1;
-
 
388
		}
-
 
389
	} else {
-
 
390
#else
-
 
391
	{
-
 
392
#endif
-
 
393
		for (i = 0; i < len; i++) {
-
 
394
			if (_fputc_r (ptr, buf[i], fp) == EOF)
-
 
395
				return -1;
-
 
396
		}
-
 
397
	}
-
 
398
	return (0);
-
 
399
}
287
#ifdef INTEGER_ONLY
400
#endif
288
/*
401
/*
289
 * Flush out all the vectors defined by the given uio,
402
 * Flush out all the vectors defined by the given uio,
290
 * then reset it so that it can be reused.
403
 * then reset it so that it can be reused.
291
 */
404
 */
Line 299... Line 412...
299
 
412
 
300
	if (uio->uio_resid == 0) {
413
	if (uio->uio_resid == 0) {
301
		uio->uio_iovcnt = 0;
414
		uio->uio_iovcnt = 0;
302
		return (0);
415
		return (0);
-
 
416
	}
303
	}
417
#ifdef _WIDE_ORIENT
304
	if (fp->_flags2 & __SWID) {
418
	if (fp->_flags2 & __SWID) {
305
		struct __siov *iov;
419
		struct __siov *iov;
306
		wchar_t *p;
420
		wchar_t *p;
Line 317... Line 431...
317
					goto out;
431
					goto out;
318
				}
432
				}
319
			}
433
			}
320
		}
434
		}
321
	} else
435
	} else
-
 
436
#endif
322
		err = __sfvwrite_r(ptr, fp, uio);
437
		err = __sfvwrite_r(ptr, fp, uio);
323
out:
438
out:
324
	uio->uio_resid = 0;
439
	uio->uio_resid = 0;
325
	uio->uio_iovcnt = 0;
440
	uio->uio_iovcnt = 0;
326
	return (err);
441
	return (err);
327
}
442
}
328
#else /* !INTEGER_ONLY */
443
#else /* !INTEGER_ONLY */
-
 
444
#ifndef _FVWRITE_IN_STREAMIO
-
 
445
int __sfputs_r (struct _reent *, FILE *, _CONST char *buf, size_t);
-
 
446
#endif
329
int __sprint_r (struct _reent *, FILE *, register struct __suio *);
447
int __sprint_r (struct _reent *, FILE *, register struct __suio *);
330
#endif /* !INTEGER_ONLY */
448
#endif /* !INTEGER_ONLY */
Line -... Line 449...
-
 
449
 
331
 
450
#ifdef _UNBUF_STREAM_OPT
332
/*
451
/*
333
 * Helper function for `fprintf to unbuffered unix file': creates a
452
 * Helper function for `fprintf to unbuffered unix file': creates a
334
 * temporary buffer.  We only work on write-only files; this avoids
453
 * temporary buffer.  We only work on write-only files; this avoids
-
 
454
 * worries about ungetc buffers and so forth.
-
 
455
 *
335
 * worries about ungetc buffers and so forth.
456
 * Make sure to avoid inlining.
336
 */
457
 */
337
static int
458
_NOINLINE_STATIC int
338
_DEFUN(__sbprintf, (rptr, fp, fmt, ap),
459
_DEFUN(__sbprintf, (rptr, fp, fmt, ap),
339
       struct _reent *rptr _AND
460
       struct _reent *rptr _AND
340
       register FILE *fp   _AND
461
       register FILE *fp   _AND
341
       _CONST char *fmt  _AND
462
       _CONST char *fmt  _AND
Line 370... Line 491...
370
#ifndef __SINGLE_THREAD__
491
#ifndef __SINGLE_THREAD__
371
	__lock_close_recursive (fake._lock);
492
	__lock_close_recursive (fake._lock);
372
#endif
493
#endif
373
	return (ret);
494
	return (ret);
374
}
495
}
-
 
496
#endif /* _UNBUF_STREAM_OPT */
375
#endif /* !STRING_ONLY */
497
#endif /* !STRING_ONLY */
Line 376... Line 498...
376
 
498
 
377
 
499
 
Line 546... Line 668...
546
{
668
{
547
	register char *fmt;	/* format string */
669
	register char *fmt;	/* format string */
548
	register int ch;	/* character from fmt */
670
	register int ch;	/* character from fmt */
549
	register int n, m;	/* handy integers (short term usage) */
671
	register int n, m;	/* handy integers (short term usage) */
550
	register char *cp;	/* handy char pointer (short term usage) */
672
	register char *cp;	/* handy char pointer (short term usage) */
551
	register struct __siov *iovp;/* for PRINT macro */
-
 
552
	register int flags;	/* flags as above */
673
	register int flags;	/* flags as above */
553
	char *fmt_anchor;       /* current format spec being processed */
674
	char *fmt_anchor;       /* current format spec being processed */
554
#ifndef _NO_POS_ARGS
675
#ifndef _NO_POS_ARGS
555
	int N;                  /* arg number */
676
	int N;                  /* arg number */
556
	int arg_index;          /* index into args processed directly */
677
	int arg_index;          /* index into args processed directly */
Line 565... Line 686...
565
	int width;		/* width from format (%8d), or 0 */
686
	int width;		/* width from format (%8d), or 0 */
566
	int prec;		/* precision from format (%.3d), or -1 */
687
	int prec;		/* precision from format (%.3d), or -1 */
567
	char sign;		/* sign prefix (' ', '+', '-', or \0) */
688
	char sign;		/* sign prefix (' ', '+', '-', or \0) */
568
#ifdef _WANT_IO_C99_FORMATS
689
#ifdef _WANT_IO_C99_FORMATS
569
				/* locale specific numeric grouping */
690
				/* locale specific numeric grouping */
570
	char *thousands_sep;
691
	char *thousands_sep = NULL;
571
	size_t thsnd_len;
692
	size_t thsnd_len = 0;
572
	const char *grouping;
693
	const char *grouping = NULL;
573
#endif
694
#endif
574
#ifdef FLOATING_POINT
695
#ifdef FLOATING_POINT
575
	char *decimal_point = _localeconv_r (data)->decimal_point;
696
	char *decimal_point = _localeconv_r (data)->decimal_point;
576
	size_t decp_len = strlen (decimal_point);
697
	size_t decp_len = strlen (decimal_point);
577
	char softsign;		/* temporary negative sign for floats */
698
	char softsign;		/* temporary negative sign for floats */
Line 583... Line 704...
583
	int lead;		/* sig figs before decimal or group sep */
704
	int lead;		/* sig figs before decimal or group sep */
584
#endif /* FLOATING_POINT */
705
#endif /* FLOATING_POINT */
585
#if defined (FLOATING_POINT) || defined (_WANT_IO_C99_FORMATS)
706
#if defined (FLOATING_POINT) || defined (_WANT_IO_C99_FORMATS)
586
	int ndig = 0;		/* actual number of digits returned by cvt */
707
	int ndig = 0;		/* actual number of digits returned by cvt */
587
#endif
708
#endif
588
#ifdef _WANT_IO_C99_FORMATS
709
#if defined (FLOATING_POINT) && defined (_WANT_IO_C99_FORMATS)
589
	int nseps;		/* number of group separators with ' */
710
	int nseps;		/* number of group separators with ' */
590
	int nrepeats;		/* number of repeats of the last group */
711
	int nrepeats;		/* number of repeats of the last group */
591
#endif
712
#endif
592
	u_quad_t _uquad;	/* integer arguments %[diouxX] */
713
	u_quad_t _uquad;	/* integer arguments %[diouxX] */
593
	enum { OCT, DEC, HEX } base;/* base for [diouxX] conversion */
714
	enum { OCT, DEC, HEX } base;/* base for [diouxX] conversion */
594
	int dprec;		/* a copy of prec if [diouxX], 0 otherwise */
715
	int dprec;		/* a copy of prec if [diouxX], 0 otherwise */
595
	int realsz;		/* field size expanded by dprec */
716
	int realsz;		/* field size expanded by dprec */
596
	int size;		/* size of converted field or string */
717
	int size;		/* size of converted field or string */
597
	char *xdigs = NULL;	/* digits for [xX] conversion */
718
	char *xdigs = NULL;	/* digits for [xX] conversion */
-
 
719
#ifdef _FVWRITE_IN_STREAMIO
598
#define NIOV 8
720
#define NIOV 8
599
	struct __suio uio;	/* output information: summary */
721
	struct __suio uio;	/* output information: summary */
600
	struct __siov iov[NIOV];/* ... and individual io vectors */
722
	struct __siov iov[NIOV];/* ... and individual io vectors */
-
 
723
	register struct __siov *iovp;/* for PRINT macro */
-
 
724
#endif
601
	char buf[BUF];		/* space for %c, %S, %[diouxX], %[aA] */
725
	char buf[BUF];		/* space for %c, %S, %[diouxX], %[aA] */
602
	char ox[2];		/* space for 0x hex-prefix */
726
	char ox[2];		/* space for 0x hex-prefix */
603
#ifdef _MB_CAPABLE
727
#ifdef _MB_CAPABLE
604
	wchar_t wc;
728
	wchar_t wc;
605
	mbstate_t state;        /* mbtowc calls from library must not change state */
729
	mbstate_t state;        /* mbtowc calls from library must not change state */
Line 621... Line 745...
621
	memset (&state, '\0', sizeof (state));
745
	memset (&state, '\0', sizeof (state));
622
#endif
746
#endif
623
	/*
747
	/*
624
	 * BEWARE, these `goto error' on error, and PAD uses `n'.
748
	 * BEWARE, these `goto error' on error, and PAD uses `n'.
625
	 */
749
	 */
-
 
750
#ifdef _FVWRITE_IN_STREAMIO
626
#define	PRINT(ptr, len) { \
751
#define	PRINT(ptr, len) { \
627
	iovp->iov_base = (ptr); \
752
	iovp->iov_base = (ptr); \
628
	iovp->iov_len = (len); \
753
	iovp->iov_len = (len); \
629
	uio.uio_resid += (len); \
754
	uio.uio_resid += (len); \
630
	iovp++; \
755
	iovp++; \
Line 655... Line 780...
655
	if (uio.uio_resid && __SPRINT(data, fp, &uio)) \
780
	if (uio.uio_resid && __SPRINT(data, fp, &uio)) \
656
		goto error; \
781
		goto error; \
657
	uio.uio_iovcnt = 0; \
782
	uio.uio_iovcnt = 0; \
658
	iovp = iov; \
783
	iovp = iov; \
659
}
784
}
-
 
785
#else
-
 
786
#define PRINT(ptr, len) {		\
-
 
787
	if (__SPRINT (data, fp, (ptr), (len)) == EOF) \
-
 
788
		goto error;		\
-
 
789
}
-
 
790
#define	PAD(howmany, with) {		\
-
 
791
	if ((n = (howmany)) > 0) {	\
-
 
792
		while (n > PADSIZE) {	\
-
 
793
			PRINT (with, PADSIZE);	\
-
 
794
			n -= PADSIZE;	\
-
 
795
		}			\
-
 
796
		PRINT (with, n);	\
-
 
797
	}				\
-
 
798
}
-
 
799
#define PRINTANDPAD(p, ep, len, with) {	\
-
 
800
	int n = (ep) - (p);		\
-
 
801
	if (n > (len))			\
-
 
802
		n = (len);		\
-
 
803
	if (n > 0)			\
-
 
804
		PRINT((p), n);		\
-
 
805
	PAD((len) - (n > 0 ? n : 0), (with)); \
-
 
806
}
-
 
807
#define FLUSH()
-
 
808
#endif
Line 660... Line 809...
660
 
809
 
661
	/* Macros to support positional arguments */
810
	/* Macros to support positional arguments */
662
#ifndef _NO_POS_ARGS
811
#ifndef _NO_POS_ARGS
663
# define GET_ARG(n, ap, type)						\
812
# define GET_ARG(n, ap, type)						\
Line 706... Line 855...
706
#endif
855
#endif
Line 707... Line 856...
707
 
856
 
708
#ifndef STRING_ONLY
857
#ifndef STRING_ONLY
709
	/* Initialize std streams if not dealing with sprintf family.  */
858
	/* Initialize std streams if not dealing with sprintf family.  */
710
	CHECK_INIT (data, fp);
859
	CHECK_INIT (data, fp);
Line 711... Line 860...
711
	_flockfile (fp);
860
    _newlib_flockfile_start (fp);
Line 712... Line 861...
712
 
861
 
713
	ORIENT(fp, -1);
862
	ORIENT(fp, -1);
714
 
863
 
715
	/* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
864
	/* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
716
	if (cantwrite (data, fp)) {
865
	if (cantwrite (data, fp)) {
Line -... Line 866...
-
 
866
		_newlib_flockfile_exit (fp);
717
		_funlockfile (fp);
867
		return (EOF);
718
		return (EOF);
868
	}
719
	}
869
 
720
 
870
#ifdef _UNBUF_STREAM_OPT
721
	/* optimise fprintf(stderr) (and other unbuffered Unix files) */
871
	/* optimise fprintf(stderr) (and other unbuffered Unix files) */
722
	if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
872
	if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
-
 
873
	    fp->_file >= 0) {
723
	    fp->_file >= 0) {
874
		_newlib_flockfile_exit (fp);
724
		_funlockfile (fp);
875
		return (__sbprintf (data, fp, fmt0, ap));
725
		return (__sbprintf (data, fp, fmt0, ap));
876
	}
726
	}
877
#endif
727
#else /* STRING_ONLY */
878
#else /* STRING_ONLY */
Line 737... Line 888...
737
		fp->_bf._size = 64;
888
		fp->_bf._size = 64;
738
        }
889
        }
739
#endif /* STRING_ONLY */
890
#endif /* STRING_ONLY */
Line 740... Line 891...
740
 
891
 
-
 
892
	fmt = (char *)fmt0;
741
	fmt = (char *)fmt0;
893
#ifdef _FVWRITE_IN_STREAMIO
742
	uio.uio_iov = iovp = iov;
894
	uio.uio_iov = iovp = iov;
743
	uio.uio_resid = 0;
895
	uio.uio_resid = 0;
-
 
896
	uio.uio_iovcnt = 0;
744
	uio.uio_iovcnt = 0;
897
#endif
745
	ret = 0;
898
	ret = 0;
746
#ifndef _NO_POS_ARGS
899
#ifndef _NO_POS_ARGS
747
	arg_index = 0;
900
	arg_index = 0;
748
	saved_fmt = NULL;
901
	saved_fmt = NULL;
Line 791... Line 944...
791
		width = 0;
944
		width = 0;
792
		prec = -1;
945
		prec = -1;
793
		sign = '\0';
946
		sign = '\0';
794
#ifdef FLOATING_POINT
947
#ifdef FLOATING_POINT
795
		lead = 0;
948
		lead = 0;
796
#endif
-
 
797
#ifdef _WANT_IO_C99_FORMATS
949
#ifdef _WANT_IO_C99_FORMATS
798
		nseps = nrepeats = 0;
950
		nseps = nrepeats = 0;
799
#endif
951
#endif
-
 
952
#endif
800
#ifndef _NO_POS_ARGS
953
#ifndef _NO_POS_ARGS
801
		N = arg_index;
954
		N = arg_index;
802
		is_pos_arg = 0;
955
		is_pos_arg = 0;
803
#endif
956
#endif
Line 1223... Line 1376...
1223
 
1376
 
1224
			if (softsign)
1377
			if (softsign)
1225
				sign = '-';
1378
				sign = '-';
1226
			break;
1379
			break;
-
 
1380
#endif /* FLOATING_POINT */
-
 
1381
#ifdef _GLIBC_EXTENSION
-
 
1382
		case 'm':  /* extension */
-
 
1383
			{
-
 
1384
				int dummy;
-
 
1385
				cp = _strerror_r (data, data->_errno, 1, &dummy);
-
 
1386
			}
-
 
1387
			flags &= ~LONGINT;
-
 
1388
			goto string;
1227
#endif /* FLOATING_POINT */
1389
#endif
1228
		case 'n':
1390
		case 'n':
1229
#ifndef _NO_LONGLONG
1391
#ifndef _NO_LONGLONG
1230
			if (flags & QUADINT)
1392
			if (flags & QUADINT)
1231
				*GET_ARG (N, ap, quad_ptr_t) = ret;
1393
				*GET_ARG (N, ap, quad_ptr_t) = ret;
Line 1270... Line 1432...
1270
			goto nosign;
1432
			goto nosign;
1271
		case 's':
1433
		case 's':
1272
#ifdef _WANT_IO_C99_FORMATS
1434
#ifdef _WANT_IO_C99_FORMATS
1273
		case 'S':
1435
		case 'S':
1274
#endif
1436
#endif
1275
			sign = '\0';
-
 
1276
			cp = GET_ARG (N, ap, char_ptr_t);
1437
			cp = GET_ARG (N, ap, char_ptr_t);
-
 
1438
#ifdef _GLIBC_EXTENSION
-
 
1439
string:
-
 
1440
#endif
-
 
1441
			sign = '\0';
1277
#ifndef __OPTIMIZE_SIZE__
1442
#ifndef __OPTIMIZE_SIZE__
1278
			/* Behavior is undefined if the user passed a
1443
			/* Behavior is undefined if the user passed a
1279
			   NULL string when precision is not 0.
1444
			   NULL string when precision is not 0.
1280
			   However, if we are not optimizing for size,
1445
			   However, if we are not optimizing for size,
1281
			   we might as well mirror glibc behavior.  */
1446
			   we might as well mirror glibc behavior.  */
Line 1619... Line 1784...
1619
	FLUSH ();
1784
	FLUSH ();
1620
error:
1785
error:
1621
	if (malloc_buf != NULL)
1786
	if (malloc_buf != NULL)
1622
		_free_r (data, malloc_buf);
1787
		_free_r (data, malloc_buf);
1623
#ifndef STRING_ONLY
1788
#ifndef STRING_ONLY
1624
	_funlockfile (fp);
1789
	_newlib_flockfile_end (fp);
1625
#endif
1790
#endif
1626
	return (__sferror (fp) ? EOF : ret);
1791
	return (__sferror (fp) ? EOF : ret);
1627
	/* NOTREACHED */
1792
	/* NOTREACHED */
1628
}
1793
}