Renumeratesorteddata

void Renumeratesorteddata(t_sorted *sd);

Renumerates all items in the autoarrangeable sorted data. Does nothing for other types of sorted data.


Parameters:

sd
(in) Pointer to the structure of type t_sorted, descriptor of sorted data


Return values:

None


If one adds or deletes items to the autoarrangeable sorted data, OllyDbg renumerates data items automatically. Calls to Renumeratesorteddata() are necessary only if data was rearranged directly, like in the following example.


Example:

This is the adapted version of the menu function that processes command "Move watch up" and "Move watch down":

// Menu function that processes commands "Move up" (index=0) and "Move down"
// (index=1).
static int Mmovewatch(t_table *pt,wchar *name,ulong index,int mode) {
  if (mode==MENU_VERIFY) {
    if (pt->sorted.n<2) return MENU_ABSENT;
    if (pt->sorted.selected==watch.sorted.n-1) return MENU_ABSENT;
    if (pt->sorted.selected==0 && index==0) return MENU_ABSENT;
    if (pt->sorted.selected==watch.sorted.n-2 && index==1) return MENU_ABSENT;
    return MENU_NORMAL; }
  else if (mode==MENU_EXECUTE) {
    Swapmem(watch.sorted.data,sizeof(t_watch),pt->sorted.selected,
      (index==0?pt->sorted.selected-1:pt->sorted.selected+1));
    Renumeratesorteddata(&(watch.sorted));
    if (index==0) pt->sorted.selected--;
    else pt->sorted.selected++;
    Maketableareavisible(pt,-1,0,pt->sorted.selected,0,pt->sorted.selected+1);
    return MENU_REDRAW; }
  else return MENU_ABSENT;
};


See also:
Sorted data, Addsorteddata()Deletesorteddata()