=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/session.c,v retrieving revision 1.37 retrieving revision 1.38 diff -c -r1.37 -r1.38 *** src/usr.bin/tmux/session.c 2013/03/22 16:00:26 1.37 --- src/usr.bin/tmux/session.c 2013/03/25 10:11:45 1.38 *************** *** 1,4 **** ! /* $OpenBSD: session.c,v 1.37 2013/03/22 16:00:26 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: session.c,v 1.38 2013/03/25 10:11:45 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 30,36 **** /* Global session list. */ struct sessions sessions; struct sessions dead_sessions; ! u_int next_session; struct session_groups session_groups; struct winlink *session_next_alert(struct winlink *); --- 30,36 ---- /* Global session list. */ struct sessions sessions; struct sessions dead_sessions; ! u_int next_session_id; struct session_groups session_groups; struct winlink *session_next_alert(struct winlink *); *************** *** 70,83 **** return (RB_FIND(sessions, &sessions, &s)); } ! /* Find session by index. */ struct session * ! session_find_by_index(u_int idx) { struct session *s; RB_FOREACH(s, sessions, &sessions) { ! if (s->idx == idx) return (s); } return (NULL); --- 70,83 ---- return (RB_FIND(sessions, &sessions, &s)); } ! /* Find session by id. */ struct session * ! session_find_by_id(u_int id) { struct session *s; RB_FOREACH(s, sessions, &sessions) { ! if (s->id == id) return (s); } return (NULL); *************** *** 121,133 **** if (name != NULL) { s->name = xstrdup(name); ! s->idx = next_session++; } else { s->name = NULL; do { ! s->idx = next_session++; free (s->name); ! xasprintf(&s->name, "%u", s->idx); } while (RB_FIND(sessions, &sessions, s) != NULL); } RB_INSERT(sessions, &sessions, s); --- 121,133 ---- if (name != NULL) { s->name = xstrdup(name); ! s->id = next_session_id++; } else { s->name = NULL; do { ! s->id = next_session_id++; free (s->name); ! xasprintf(&s->name, "%u", s->id); } while (RB_FIND(sessions, &sessions, s) != NULL); } RB_INSERT(sessions, &sessions, s);