Merge pull request #2631 from ianyfan/swaybar

bar: remove i3bar_block_free in favour of i3bar_block_unref
This commit is contained in:
emersion 2018-09-14 22:19:40 +02:00 committed by GitHub
commit b842b4f32e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,22 +8,19 @@
#include "swaybar/config.h"
#include "swaybar/status_line.h"
static void i3bar_block_free(struct i3bar_block *block) {
if (!block) {
void i3bar_block_unref(struct i3bar_block *block) {
if (block == NULL) {
return;
}
free(block->full_text);
free(block->short_text);
free(block->align);
free(block->name);
free(block->instance);
free(block->color);
free(block);
}
void i3bar_block_unref(struct i3bar_block *block) {
if (--block->ref_count == 0) {
i3bar_block_free(block);
free(block->full_text);
free(block->short_text);
free(block->align);
free(block->name);
free(block->instance);
free(block->color);
free(block);
}
}