+int
+swap_item(Menu* menu, int src_index, int dest_index)
+{
+ MenuItem* temp;
+
+ temp = menu->menu_items[dest_index];
+ menu->menu_items[dest_index] = menu->menu_items[src_index];
+ menu->menu_items[src_index] = temp;
+
+ return 0;
+}
+
+int
+delete_item(Menu* menu, int index)
+{
+ if (index < 0 || index > menu->menu_length-1) return -1;
+
+ int temp_size = (menu->menu_length-index-1)*sizeof(MenuItem*);
+ MenuItem* temp[temp_size];
+
+ /* might break if last item? */
+ memcpy(temp, menu->menu_items[index+1], temp_size);
+ memcpy(menu->menu_items[index], temp, temp_size);
+
+ menu->menu_items = realloc(menu->menu_items, menu->menu_length*sizeof(MenuItem*));
+ menu->menu_items[menu->menu_length-1] = 0; // preserve null at end
+
+ menu->menu_length -= 1;
+
+ /* also move the current selected position if it's last */
+ if (menu->selected_item > menu->menu_length-1) {
+ menu->selected_item = menu->menu_length-1;
+ }
+
+ return 0;
+}
+