version 1.62, 2011/01/08 01:52:37 |
version 1.63, 2011/01/25 22:31:50 |
|
|
} |
} |
|
|
struct winlink * |
struct winlink * |
winlink_add(struct winlinks *wwl, struct window *w, int idx) |
winlink_add(struct winlinks *wwl, int idx) |
{ |
{ |
struct winlink *wl; |
struct winlink *wl; |
|
|
|
|
|
|
wl = xcalloc(1, sizeof *wl); |
wl = xcalloc(1, sizeof *wl); |
wl->idx = idx; |
wl->idx = idx; |
wl->window = w; |
|
RB_INSERT(winlinks, wwl, wl); |
RB_INSERT(winlinks, wwl, wl); |
|
|
w->references++; |
|
|
|
return (wl); |
return (wl); |
} |
} |
|
|
void |
void |
|
winlink_set_window(struct winlink *wl, struct window *w) |
|
{ |
|
wl->window = w; |
|
w->references++; |
|
} |
|
|
|
void |
winlink_remove(struct winlinks *wwl, struct winlink *wl) |
winlink_remove(struct winlinks *wwl, struct winlink *wl) |
{ |
{ |
struct window *w = wl->window; |
struct window *w = wl->window; |
|
|
xfree(wl->status_text); |
xfree(wl->status_text); |
xfree(wl); |
xfree(wl); |
|
|
if (w->references == 0) |
if (w != NULL) { |
fatal("bad reference count"); |
if (w->references == 0) |
w->references--; |
fatal("bad reference count"); |
if (w->references == 0) |
w->references--; |
window_destroy(w); |
if (w->references == 0) |
|
window_destroy(w); |
|
} |
} |
} |
|
|
struct winlink * |
struct winlink * |