Revision 18be5187 vl.c

b/vl.c
6060 6060

  
6061 6061
static SaveStateEntry *first_se;
6062 6062

  
6063
/* TODO: Individual devices generally have very little idea about the rest
6064
   of the system, so instance_id should be removed/replaced.  */
6063 6065
int register_savevm(const char *idstr,
6064 6066
                    int instance_id,
6065 6067
                    int version_id,
......
6073 6075
    if (!se)
6074 6076
        return -1;
6075 6077
    pstrcpy(se->idstr, sizeof(se->idstr), idstr);
6076
    se->instance_id = instance_id;
6078
    se->instance_id = (instance_id == -1) ? 0 : instance_id;
6077 6079
    se->version_id = version_id;
6078 6080
    se->save_state = save_state;
6079 6081
    se->load_state = load_state;
......
6082 6084

  
6083 6085
    /* add at the end of list */
6084 6086
    pse = &first_se;
6085
    while (*pse != NULL)
6087
    while (*pse != NULL) {
6088
        if (instance_id == -1
6089
                && strcmp(se->idstr, (*pse)->idstr) == 0
6090
                && se->instance_id <= (*pse)->instance_id)
6091
            se->instance_id = (*pse)->instance_id + 1;
6086 6092
        pse = &(*pse)->next;
6093
    }
6087 6094
    *pse = se;
6088 6095
    return 0;
6089 6096
}

Also available in: Unified diff