< prev index next >

src/java.desktop/unix/native/libawt_xawt/awt/list.c

Print this page

        

@@ -65,10 +65,11 @@
 
   ----------------------------------------------------------------------- **/
 
 #include <stdio.h>
 #include <stdlib.h>
+#include "X11/Xfuncproto.h"
 #include "list.h"
 
 
 /** ------------------------------------------------------------------------
         Sets the pointers of the specified list to NULL.

@@ -118,13 +119,13 @@
         Creates a new list and sets its pointers to NULL.
         Returns a pointer to the new list.
     -------------------------------------------------------------------- **/
 list_ptr new_list ()
 {
-    list_ptr lp;
+    list_ptr lp = (list_ptr) malloc( sizeof( list_item));
 
-    if (lp = (list_ptr) malloc( sizeof( list_item))) {
+    if (lp != NULL) {
         lp->next = NULL;
         lp->ptr.item = NULL;
     }
 
     return lp;

@@ -146,14 +147,13 @@
 list_ptr dup_list_head(lp, start_at_curr)
     list_ptr lp;
     int32_t start_at_curr;
 #endif
 {
-    list_ptr new_list;
-
-    if ((new_list = (list_ptr) malloc( sizeof( list_item))) == NULL) {
+    list_ptr new_list = (list_ptr) malloc( sizeof( list_item));
 
+    if (new_list == NULL) {
         return (list_ptr)NULL;
     }
     new_list->next = start_at_curr ? lp->ptr.curr : lp->next;
     new_list->ptr.curr = lp->ptr.curr;
 
< prev index next >