Browse Source

Revert revision 19345 plus libc_hidden_proto for __uc_malloc.

Bernd Schmidt 16 years ago
parent
commit
74d1d18f6b
2 changed files with 6 additions and 16 deletions
  1. 4 9
      libc/misc/utmp/utent.c
  2. 2 7
      libc/unistd/getpass.c

+ 4 - 9
libc/misc/utmp/utent.c

@@ -14,7 +14,6 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <unistd.h>
-#include <malloc.h>
 #include <fcntl.h>
 #include <fcntl.h>
 #include <paths.h>
 #include <paths.h>
 #include <errno.h>
 #include <errno.h>
@@ -30,7 +29,6 @@ libc_hidden_proto(open)
 libc_hidden_proto(fcntl)
 libc_hidden_proto(fcntl)
 libc_hidden_proto(close)
 libc_hidden_proto(close)
 libc_hidden_proto(lseek)
 libc_hidden_proto(lseek)
-libc_hidden_proto(__uc_malloc)
 
 
 #include <bits/uClibc_mutex.h>
 #include <bits/uClibc_mutex.h>
 __UCLIBC_MUTEX_STATIC(utmplock, PTHREAD_MUTEX_INITIALIZER);
 __UCLIBC_MUTEX_STATIC(utmplock, PTHREAD_MUTEX_INITIALIZER);
@@ -38,10 +36,9 @@ __UCLIBC_MUTEX_STATIC(utmplock, PTHREAD_MUTEX_INITIALIZER);
 
 
 
 
 /* Some global crap */
 /* Some global crap */
-static const char default_file_name[] = _PATH_UTMP;
-
 static int static_fd = -1;
 static int static_fd = -1;
-static struct utmp *static_utmp;
+static struct utmp static_utmp;
+static const char default_file_name[] = _PATH_UTMP;
 static const char *static_ut_name = (const char *) default_file_name;
 static const char *static_ut_name = (const char *) default_file_name;
 
 
 /* This function must be called with the LOCK held */
 /* This function must be called with the LOCK held */
@@ -92,11 +89,9 @@ static struct utmp *__getutent(int utmp_fd)
 	return NULL;
 	return NULL;
     }
     }
 
 
-    free(static_utmp);
-    static_utmp = __uc_malloc(sizeof(*static_utmp));
-    if (read(utmp_fd, (char *) static_utmp, sizeof(*static_utmp)) == sizeof(*static_utmp))
+    if (read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) == sizeof(struct utmp))
     {
     {
-	ret = static_utmp;
+	ret = &static_utmp;
     }
     }
 
 
     return ret;
     return ret;

+ 2 - 7
libc/unistd/getpass.c

@@ -20,7 +20,7 @@
 #include <string.h>
 #include <string.h>
 #include <termios.h>
 #include <termios.h>
 #include <unistd.h>
 #include <unistd.h>
-#include <malloc.h>
+#include <string.h>
 
 
 #if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
 #if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
 
 
@@ -37,7 +37,6 @@ libc_hidden_proto(fputs)
 libc_hidden_proto(fputc)
 libc_hidden_proto(fputc)
 libc_hidden_proto(putc)
 libc_hidden_proto(putc)
 libc_hidden_proto(__fputc_unlocked)
 libc_hidden_proto(__fputc_unlocked)
-libc_hidden_proto(__uc_malloc)
 
 
 /* It is desirable to use this bit on systems that have it.
 /* It is desirable to use this bit on systems that have it.
    The only bit of terminal state we want to twiddle is echoing, which is
    The only bit of terminal state we want to twiddle is echoing, which is
@@ -51,16 +50,12 @@ libc_hidden_proto(__uc_malloc)
 
 
 char * getpass (const char *prompt)
 char * getpass (const char *prompt)
 {
 {
-  static char *buf;
-
   FILE *in, *out;
   FILE *in, *out;
   struct termios s, t;
   struct termios s, t;
   int tty_changed;
   int tty_changed;
+  static char buf[PWD_BUFFER_SIZE];
   int nread;
   int nread;
 
 
-  free(buf);
-  buf = __uc_malloc(PWD_BUFFER_SIZE);
-
   /* Try to write to and read from the terminal if we can.
   /* Try to write to and read from the terminal if we can.
      If we can't open the terminal, use stderr and stdin.  */
      If we can't open the terminal, use stderr and stdin.  */