< prev index next >

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

Print this page




 105     }
 106     if ((lp->next = (list_ptr) malloc( sizeof( list_item))) == NULL) {
 107 
 108         return 0;
 109     }
 110     lp->next->ptr.item = item;
 111     lp->next->next = NULL;
 112 
 113     return 1;
 114 }
 115 
 116 
 117 /** ------------------------------------------------------------------------
 118         Creates a new list and sets its pointers to NULL.
 119         Returns a pointer to the new list.
 120     -------------------------------------------------------------------- **/
 121 list_ptr new_list ()
 122 {
 123     list_ptr lp;
 124 
 125     if (lp = (list_ptr) malloc( sizeof( list_item))) {
 126         lp->next = NULL;
 127         lp->ptr.item = NULL;
 128     }
 129 
 130     return lp;
 131 }
 132 
 133 
 134 /** ------------------------------------------------------------------------
 135         Creates a new list head, pointing to the same list as the one
 136         passed in.  If start_at_curr is TRUE, the new list's first item
 137         is the "current" item (as set by calls to first/next_in_list()).
 138         If start_at_curr is FALSE, the first item in the new list is the
 139         same as the first item in the old list.  In either case, the
 140         curr pointer in the new list is the same as in the old list.
 141         Returns a pointer to the new list head.
 142     -------------------------------------------------------------------- **/
 143 #if NeedFunctionPrototypes
 144 list_ptr dup_list_head(list_ptr lp, int32_t start_at_curr)
 145 #else




 105     }
 106     if ((lp->next = (list_ptr) malloc( sizeof( list_item))) == NULL) {
 107 
 108         return 0;
 109     }
 110     lp->next->ptr.item = item;
 111     lp->next->next = NULL;
 112 
 113     return 1;
 114 }
 115 
 116 
 117 /** ------------------------------------------------------------------------
 118         Creates a new list and sets its pointers to NULL.
 119         Returns a pointer to the new list.
 120     -------------------------------------------------------------------- **/
 121 list_ptr new_list ()
 122 {
 123     list_ptr lp;
 124 
 125     if ((lp = (list_ptr) malloc( sizeof( list_item)))) {
 126         lp->next = NULL;
 127         lp->ptr.item = NULL;
 128     }
 129 
 130     return lp;
 131 }
 132 
 133 
 134 /** ------------------------------------------------------------------------
 135         Creates a new list head, pointing to the same list as the one
 136         passed in.  If start_at_curr is TRUE, the new list's first item
 137         is the "current" item (as set by calls to first/next_in_list()).
 138         If start_at_curr is FALSE, the first item in the new list is the
 139         same as the first item in the old list.  In either case, the
 140         curr pointer in the new list is the same as in the old list.
 141         Returns a pointer to the new list head.
 142     -------------------------------------------------------------------- **/
 143 #if NeedFunctionPrototypes
 144 list_ptr dup_list_head(list_ptr lp, int32_t start_at_curr)
 145 #else


< prev index next >