summaryrefslogtreecommitdiff
path: root/src/input.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/input.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/input.c')
-rw-r--r--src/input.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/input.c b/src/input.c
index 41b4e2e..64725d9 100644
--- a/src/input.c
+++ b/src/input.c
@@ -43,12 +43,7 @@ keysym_to_string (KeySym keysym, unsigned int modifier)
unsigned char *name;
int pos, i;
- name = malloc (15);
- if (name == NULL)
- {
- PRINT_ERROR ("Out of memory!\n");
- exit (EXIT_FAILURE);
- }
+ name = xmalloc (15);
for (pos = 0, i = 0; i < 6; i++)
{
@@ -177,12 +172,7 @@ get_more_input (char *prompt, char *preinput)
char *str;
/* Allocate some memory to start with */
- str = (char *) malloc ( allocated_len );
- if ( str == NULL )
- {
- PRINT_ERROR ("Out of memory\n");
- exit (EXIT_FAILURE);
- }
+ str = (char *) xmalloc ( allocated_len );
/* load in the preinput */
strcpy (str, preinput);
@@ -216,12 +206,7 @@ get_more_input (char *prompt, char *preinput)
if (cur_len > allocated_len - 1)
{
allocated_len += 100;
- str = realloc ( str, allocated_len );
- if (str == NULL)
- {
- PRINT_ERROR ("Out of memory\n");
- exit (EXIT_FAILURE);
- }
+ str = xrealloc ( str, allocated_len );
}
str[cur_len] = ch;
cur_len++;