@@ -1398,24 +1398,32 @@ struct listwatch_S
13981398 * Order of members is optimized to reduce padding.
13991399 * When created by range() it will at first have special value:
14001400 * lv_first == &range_list_item;
1401- * lv_last == start
1402- * lv_idx_item == end
1403- * lv_idx == stride
1401+ * and use lv_start, lv_end, lv_stride.
14041402 */
14051403struct listvar_S
14061404{
14071405 listitem_T * lv_first ; // first item, NULL if none
1408- listitem_T * lv_last ; // last item, NULL if none
14091406 listwatch_T * lv_watch ; // first watcher, NULL if none
1410- listitem_T * lv_idx_item ; // when not NULL item at index "lv_idx"
1407+ union {
1408+ struct { // used for non-materialized range list:
1409+ // "lv_first" is &range_list_item
1410+ varnumber_T lv_start ;
1411+ varnumber_T lv_end ;
1412+ int lv_stride ;
1413+ };
1414+ struct { // used for materialized list
1415+ listitem_T * lv_last ; // last item, NULL if none
1416+ listitem_T * lv_idx_item ; // when not NULL item at index "lv_idx"
1417+ int lv_idx ; // cached index of an item
1418+ };
1419+ };
14111420 list_T * lv_copylist ; // copied list used by deepcopy()
14121421 list_T * lv_used_next ; // next list in used lists list
14131422 list_T * lv_used_prev ; // previous list in used lists list
14141423 int lv_refcount ; // reference count
14151424 int lv_len ; // number of items
14161425 int lv_with_items ; // number of items following this struct that
14171426 // should not be freed
1418- int lv_idx ; // cached index of an item
14191427 int lv_copyID ; // ID used by deepcopy()
14201428 char lv_lock ; // zero, VAR_LOCKED, VAR_FIXED
14211429};
0 commit comments