Deleted Added
full compact
findfp.c (72128) findfp.c (72373)
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 25 unchanged lines hidden (view full) ---

34 * SUCH DAMAGE.
35 */
36
37#if defined(LIBC_SCCS) && !defined(lint)
38#if 0
39static char sccsid[] = "@(#)findfp.c 8.2 (Berkeley) 1/4/94";
40#endif
41static const char rcsid[] =
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 25 unchanged lines hidden (view full) ---

34 * SUCH DAMAGE.
35 */
36
37#if defined(LIBC_SCCS) && !defined(lint)
38#if 0
39static char sccsid[] = "@(#)findfp.c 8.2 (Berkeley) 1/4/94";
40#endif
41static const char rcsid[] =
42 "$FreeBSD: head/lib/libc/stdio/findfp.c 72128 2001-02-07 17:34:48Z sobomax $";
42 "$FreeBSD: head/lib/libc/stdio/findfp.c 72373 2001-02-11 22:06:43Z deischen $";
43#endif /* LIBC_SCCS and not lint */
44
45#include <sys/param.h>
46#include <machine/atomic.h>
47#include <unistd.h>
48#include <stdio.h>
49#include <stdlib.h>
50#include <string.h>

--- 26 unchanged lines hidden (view full) ---

77
78static struct glue * moreglue __P((int));
79
80static spinlock_t thread_lock = _SPINLOCK_INITIALIZER;
81#define THREAD_LOCK() if (__isthreaded) _SPINLOCK(&thread_lock)
82#define THREAD_UNLOCK() if (__isthreaded) _SPINUNLOCK(&thread_lock)
83
84#if NOT_YET
43#endif /* LIBC_SCCS and not lint */
44
45#include <sys/param.h>
46#include <machine/atomic.h>
47#include <unistd.h>
48#include <stdio.h>
49#include <stdlib.h>
50#include <string.h>

--- 26 unchanged lines hidden (view full) ---

77
78static struct glue * moreglue __P((int));
79
80static spinlock_t thread_lock = _SPINLOCK_INITIALIZER;
81#define THREAD_LOCK() if (__isthreaded) _SPINLOCK(&thread_lock)
82#define THREAD_UNLOCK() if (__isthreaded) _SPINUNLOCK(&thread_lock)
83
84#if NOT_YET
85#define SET_GLUE_PTR(ptr, val) atomic_set_ptr(&(ptr), (uintptr_t)(val))
85#define SET_GLUE_PTR(ptr, val) atomic_set_rel_ptr(&(ptr), (uintptr_t)(val))
86#else
87#define SET_GLUE_PTR(ptr, val) ptr = val
88#endif
89
90static struct glue *
91moreglue(n)
92 int n;
93{

--- 51 unchanged lines hidden (view full) ---

145 fp->_bf._size = 0;
146 fp->_lbfsize = 0; /* not line buffered */
147 fp->_file = -1; /* no file */
148/* fp->_cookie = <any>; */ /* caller sets cookie, _read/_write etc */
149 fp->_ub._base = NULL; /* no ungetc buffer */
150 fp->_ub._size = 0;
151 fp->_lb._base = NULL; /* no line buffer */
152 fp->_lb._size = 0;
86#else
87#define SET_GLUE_PTR(ptr, val) ptr = val
88#endif
89
90static struct glue *
91moreglue(n)
92 int n;
93{

--- 51 unchanged lines hidden (view full) ---

145 fp->_bf._size = 0;
146 fp->_lbfsize = 0; /* not line buffered */
147 fp->_file = -1; /* no file */
148/* fp->_cookie = <any>; */ /* caller sets cookie, _read/_write etc */
149 fp->_ub._base = NULL; /* no ungetc buffer */
150 fp->_ub._size = 0;
151 fp->_lb._base = NULL; /* no line buffer */
152 fp->_lb._size = 0;
153 /* fp->_lock = NULL; */
153/* fp->_lock = NULL; */ /* once set always set (reused) */
154 return (fp);
155}
156
157/*
158 * XXX. Force immediate allocation of internal memory. Not used by stdio,
159 * but documented historically for certain applications. Bad applications.
160 */
161__warn_references(f_prealloc,

--- 36 unchanged lines hidden (view full) ---

198}
199
200/*
201 * __sinit() is called whenever stdio's internal variables must be set up.
202 */
203void
204__sinit()
205{
154 return (fp);
155}
156
157/*
158 * XXX. Force immediate allocation of internal memory. Not used by stdio,
159 * but documented historically for certain applications. Bad applications.
160 */
161__warn_references(f_prealloc,

--- 36 unchanged lines hidden (view full) ---

198}
199
200/*
201 * __sinit() is called whenever stdio's internal variables must be set up.
202 */
203void
204__sinit()
205{
206 /* make sure we clean up on exit */
206 /* Make sure we clean up on exit. */
207 __cleanup = _cleanup; /* conservative */
208 __sdidinit = 1;
209}
207 __cleanup = _cleanup; /* conservative */
208 __sdidinit = 1;
209}