]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-bionic.git/blobdiff - linker/linked_list.h
Support gethostbyname_r_ERANGE.
[android-sdk/platform-bionic.git] / linker / linked_list.h
index 72a32b4ba9f907dc87e68a62b88010d9fbcf1ab9..a72b73ccd6753cf0d7a5b25b42819efbdcabce3f 100644 (file)
@@ -36,6 +36,12 @@ class LinkedList {
     clear();
   }
 
+  LinkedList(LinkedList&& that) {
+    this->head_ = that.head_;
+    this->tail_ = that.tail_;
+    that.head_ = that.tail_ = nullptr;
+  }
+
   void push_front(T* const element) {
     LinkedListEntry<T>* new_entry = Allocator::alloc();
     new_entry->next = head_;
@@ -75,6 +81,14 @@ class LinkedList {
     return element;
   }
 
+  T* front() const {
+    if (head_ == nullptr) {
+      return nullptr;
+    }
+
+    return head_->element;
+  }
+
   void clear() {
     while (head_ != nullptr) {
       LinkedListEntry<T>* p = head_;
@@ -140,6 +154,12 @@ class LinkedList {
     return false;
   }
 
+  static LinkedList make_list(T* const element) {
+    LinkedList<T, Allocator> one_element_list;
+    one_element_list.push_back(element);
+    return one_element_list;
+  }
+
  private:
   LinkedListEntry<T>* head_;
   LinkedListEntry<T>* tail_;