aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorAndreas Schwab <[email protected]>2011-07-10 10:20:10 +0200
committerAndreas Schwab <[email protected]>2011-07-10 10:20:10 +0200
commit1dae0f0aadd0e0fe51893aff89bb3220cba953db (patch)
tree771e2250c7fad12abc3bace5f91fd7e7963fdc55 /src/buffer.c
parent99033785c7adac8711cc7c56a99c4e3b441648b1 (diff)
Protoize
* src/buffer.c (mmap_init, mmap_find, mmap_free_1, mmap_enlarge) (mmap_set_vars, mmap_alloc, mmap_free, mmap_realloc): Protoize. * src/data.c (fmod): Likewise. * src/dispnew.c (swap_glyphs_in_rows): Likewise. * src/emacs.c (memory_warning_signal): Likewise. * src/floatfns.c (float_error): Likewise. * src/font.c (check_gstring, check_otf_features, otf_tag_symbol) (otf_open, font_otf_capability, generate_otf_features) (font_otf_DeviceTable, font_otf_ValueRecord, font_otf_Anchor): Likewise. * src/image.c (pbm_read_file): Likewise. * src/indent.c (string_display_width): Likewise. * src/intervals.c (check_for_interval, search_for_interval) (inc_interval_count, count_intervals, root_interval) (adjust_intervals_for_insertion, make_new_interval): Likewise. * src/lread.c (defalias): Likewise. * src/regex.c (set_image_of_range_1, set_image_of_range) (regex_grow_registers): Likewise. * src/sysdep.c (strerror): Likewise. * src/termcap.c (valid_filename_p, tprint, main): Likewise. * src/tparam.c (main): Likewise. * src/unexhp9k800.c (run_time_remap, save_data_space) (update_file_ptrs, read_header, write_header, calculate_checksum) (copy_file, copy_rest, display_header): Likewise. * src/widget.c (mark_shell_size_user_specified, create_frame_gcs): Likewise. * src/xdisp.c (check_it): Likewise. * src/xfaces.c (register_color, unregister_color, unregister_colors): Likewise. * src/xfns.c (print_fontset_result): Likewise. * src/xrdb.c (member, fatal, main): Likewise.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c115
1 files changed, 47 insertions, 68 deletions
diff --git a/src/buffer.c b/src/buffer.c
index e2f34d629e..1b8b111789 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4466,24 +4466,40 @@ static int mmap_initialized_p;
#define MMAP_ALLOCATED_P(start, end) 1
#endif
-/* Function prototypes. */
+/* Perform necessary intializations for the use of mmap. */
-static int mmap_free_1 (struct mmap_region *);
-static int mmap_enlarge (struct mmap_region *, int);
-static struct mmap_region *mmap_find (POINTER_TYPE *, POINTER_TYPE *);
-static POINTER_TYPE *mmap_alloc (POINTER_TYPE **, size_t);
-static POINTER_TYPE *mmap_realloc (POINTER_TYPE **, size_t);
-static void mmap_free (POINTER_TYPE **ptr);
-static void mmap_init (void);
+static void
+mmap_init (void)
+{
+#if MAP_ANON == 0
+ /* The value of mmap_fd is initially 0 in temacs, and -1
+ in a dumped Emacs. */
+ if (mmap_fd <= 0)
+ {
+ /* No anonymous mmap -- we need the file descriptor. */
+ mmap_fd = open ("/dev/zero", O_RDONLY);
+ if (mmap_fd == -1)
+ fatal ("Cannot open /dev/zero: %s", emacs_strerror (errno));
+ }
+#endif /* MAP_ANON == 0 */
+
+ if (mmap_initialized_p)
+ return;
+ mmap_initialized_p = 1;
+#if MAP_ANON != 0
+ mmap_fd = -1;
+#endif
+
+ mmap_page_size = getpagesize ();
+}
/* Return a region overlapping address range START...END, or null if
none. END is not including, i.e. the last byte in the range
is at END - 1. */
static struct mmap_region *
-mmap_find (start, end)
- POINTER_TYPE *start, *end;
+mmap_find (POINTER_TYPE *start, POINTER_TYPE *end);
{
struct mmap_region *r;
char *s = (char *) start, *e = (char *) end;
@@ -4512,8 +4528,7 @@ mmap_find (start, end)
the region. Value is non-zero if successful. */
static int
-mmap_free_1 (r)
- struct mmap_region *r;
+mmap_free_1 (struct mmap_region *r)
{
if (r->next)
r->next->prev = r->prev;
@@ -4536,9 +4551,7 @@ mmap_free_1 (r)
Value is non-zero if successful. */
static int
-mmap_enlarge (r, npages)
- struct mmap_region *r;
- int npages;
+mmap_enlarge (struct mmap_region *r, int npages)
{
char *region_end = (char *) r + r->nbytes_mapped;
size_t nbytes;
@@ -4602,8 +4615,7 @@ mmap_enlarge (r, npages)
when Emacs starts. */
void
-mmap_set_vars (restore_p)
- int restore_p;
+mmap_set_vars (int restore_p)
{
struct mmap_region *r;
@@ -4636,9 +4648,7 @@ mmap_set_vars (restore_p)
return null. */
static POINTER_TYPE *
-mmap_alloc (var, nbytes)
- POINTER_TYPE **var;
- size_t nbytes;
+mmap_alloc (POINTER_TYPE **var, size_t nbytes)
{
void *p;
size_t map;
@@ -4675,15 +4685,29 @@ mmap_alloc (var, nbytes)
}
+/* Free a block of relocatable storage whose data is pointed to by
+ PTR. Store 0 in *PTR to show there's no block allocated. */
+
+static void
+mmap_free (POINTER_TYPE **var)
+{
+ mmap_init ();
+
+ if (*var)
+ {
+ mmap_free_1 (MMAP_REGION (*var));
+ *var = NULL;
+ }
+}
+
+
/* Given a pointer at address VAR to data allocated with mmap_alloc,
resize it to size NBYTES. Change *VAR to reflect the new block,
and return this value. If more memory cannot be allocated, then
leave *VAR unchanged, and return null. */
static POINTER_TYPE *
-mmap_realloc (var, nbytes)
- POINTER_TYPE **var;
- size_t nbytes;
+mmap_realloc (POINTER_TYPE **var, size_t nbytes)
{
POINTER_TYPE *result;
@@ -4753,51 +4777,6 @@ mmap_realloc (var, nbytes)
}
-/* Free a block of relocatable storage whose data is pointed to by
- PTR. Store 0 in *PTR to show there's no block allocated. */
-
-static void
-mmap_free (var)
- POINTER_TYPE **var;
-{
- mmap_init ();
-
- if (*var)
- {
- mmap_free_1 (MMAP_REGION (*var));
- *var = NULL;
- }
-}
-
-
-/* Perform necessary intializations for the use of mmap. */
-
-static void
-mmap_init ()
-{
-#if MAP_ANON == 0
- /* The value of mmap_fd is initially 0 in temacs, and -1
- in a dumped Emacs. */
- if (mmap_fd <= 0)
- {
- /* No anonymous mmap -- we need the file descriptor. */
- mmap_fd = open ("/dev/zero", O_RDONLY);
- if (mmap_fd == -1)
- fatal ("Cannot open /dev/zero: %s", emacs_strerror (errno));
- }
-#endif /* MAP_ANON == 0 */
-
- if (mmap_initialized_p)
- return;
- mmap_initialized_p = 1;
-
-#if MAP_ANON != 0
- mmap_fd = -1;
-#endif
-
- mmap_page_size = getpagesize ();
-}
-
#endif /* USE_MMAP_FOR_BUFFERS */