Revision e31e3694 ui/vnc-palette.c
b/ui/vnc-palette.c | ||
---|---|---|
63 | 63 |
|
64 | 64 |
void palette_destroy(VncPalette *palette) |
65 | 65 |
{ |
66 |
int i; |
|
67 |
|
|
68 | 66 |
if (palette == NULL) { |
69 |
return ;
|
|
67 |
qemu_free(palette);
|
|
70 | 68 |
} |
71 |
|
|
72 |
for (i = 0; i < VNC_PALETTE_HASH_SIZE; i++) { |
|
73 |
VncPaletteEntry *entry = QLIST_FIRST(&palette->table[i]); |
|
74 |
while (entry) { |
|
75 |
VncPaletteEntry *tmp = QLIST_NEXT(entry, next); |
|
76 |
QLIST_REMOVE(entry, next); |
|
77 |
qemu_free(entry); |
|
78 |
entry = tmp; |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
qemu_free(palette); |
|
83 | 69 |
} |
84 | 70 |
|
85 | 71 |
int palette_put(VncPalette *palette, uint32_t color) |
... | ... | |
97 | 83 |
if (!entry) { |
98 | 84 |
VncPaletteEntry *entry; |
99 | 85 |
|
100 |
entry = qemu_mallocz(sizeof(*entry));
|
|
86 |
entry = &palette->pool[palette->size];
|
|
101 | 87 |
entry->color = color; |
102 | 88 |
entry->idx = idx; |
103 | 89 |
QLIST_INSERT_HEAD(&palette->table[hash], entry, next); |
Also available in: Unified diff