summaryrefslogtreecommitdiff
path: root/src/list.c
diff options
context:
space:
mode:
authorrcyeske <rcyeske>2001-03-02 06:06:23 +0000
committerrcyeske <rcyeske>2001-03-02 06:06:23 +0000
commit46d33884f2f1061ae1a77c26928f97d573e57c6c (patch)
tree39c8a9fe54a29d761a797cc9124f945ded2ecc3c /src/list.c
parent58e95be4eab6d82257214d76414c9eef901c5915 (diff)
downloadratpoison-46d33884f2f1061ae1a77c26928f97d573e57c6c.zip
* ratpoison.h (xmalloc, xrealloc, fatal): Prototype.
* main.c (xmalloc): Move here from sbuf.c. (xrealloc): Likewise. (fatal): Likewise. * number.c (find_empty_cell): Use xrealloc, remove error check. (init_numbers): Likewise. * manage.c (get_window_name): Likewise. * main.c (main): Likewise. * list.c (add_to_window_list): Likewise. (add_to_window_list): Likewise. * events.c (handle_key): Likewise. * input.c (keysym_to_string): Likewise. (get_more_input): Use xrealloc, remove error check. * main.c (read_rc_file): Take a file pointer rather than a filename. (read_startup_files): If ~/.ratpoisonrc is not readable try /etc/ratpoisonrc.
Diffstat (limited to 'src/list.c')
-rw-r--r--src/list.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/list.c b/src/list.c
index 12b5bbb..2192b1e 100644
--- a/src/list.c
+++ b/src/list.c
@@ -47,12 +47,8 @@ add_to_window_list (screen_info *s, Window w)
{
rp_window *new_window;
- new_window = malloc (sizeof (rp_window));
- if (new_window == NULL)
- {
- PRINT_ERROR ("Out of memory!\n");
- exit (EXIT_FAILURE);
- }
+ new_window = xmalloc (sizeof (rp_window));
+
new_window->w = w;
new_window->scr = s;
new_window->last_access = 0;
@@ -69,11 +65,8 @@ add_to_window_list (screen_info *s, Window w)
XSelectInput (dpy, new_window->w, PropertyChangeMask | ColormapChangeMask);
- if ((new_window->name = malloc (strlen ("Unnamed") + 1)) == NULL)
- {
- PRINT_ERROR ("Out of memory!\n");
- exit (EXIT_FAILURE);
- }
+ new_window->name = xmalloc (strlen ("Unnamed") + 1);
+
strcpy (new_window->name, "Unnamed");
/* Add the window to the end of the unmapped list. */
@@ -123,15 +116,8 @@ set_current_window (rp_window *win)
void
init_window_list ()
{
- rp_mapped_window_sentinel = malloc (sizeof (rp_window));
- rp_unmapped_window_sentinel = malloc (sizeof (rp_window));
-
- if (!rp_mapped_window_sentinel
- || !rp_unmapped_window_sentinel)
- {
- PRINT_ERROR ("Out of memory!\n");
- exit (EXIT_FAILURE);
- }
+ rp_mapped_window_sentinel = xmalloc (sizeof (rp_window));
+ rp_unmapped_window_sentinel = xmalloc (sizeof (rp_window));
rp_mapped_window_sentinel->next = rp_mapped_window_sentinel;
rp_mapped_window_sentinel->prev = rp_mapped_window_sentinel;