Skip to content

Commit 176f3db

Browse files
committed
Drop Manager member current_cursor
The member current_cursor is used only locally in a single function, and always assigned before usage.
1 parent 5b8304b commit 176f3db

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/netlog/netlog-manager.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ static int load_cursor_state(Manager *m) {
263263
}
264264

265265
static int process_journal_input(Manager *m) {
266+
_cleanup_free_ char *cursor = NULL;
266267
int r;
267268

268269
assert(m);
@@ -278,7 +279,6 @@ static int process_journal_input(Manager *m) {
278279

279280
r = manager_read_journal_input(m);
280281
if (r < 0) {
281-
m->current_cursor = mfree(m->current_cursor);
282282
/* Can't send the message. Seek one entry back. */
283283
r = sd_journal_previous(m->journal);
284284
if (r < 0)
@@ -288,15 +288,15 @@ static int process_journal_input(Manager *m) {
288288
}
289289
}
290290

291-
r = sd_journal_get_cursor(m->journal, &m->current_cursor);
291+
r = sd_journal_get_cursor(m->journal, &cursor);
292292
if (r < 0) {
293293
log_error_errno(r, "Failed to get cursor: %m");
294-
m->current_cursor = mfree(m->current_cursor);
294+
cursor = mfree(cursor);
295295
}
296296

297297
free(m->last_cursor);
298-
m->last_cursor = m->current_cursor;
299-
m->current_cursor = NULL;
298+
m->last_cursor = cursor;
299+
cursor = NULL;
300300

301301
return update_cursor_state(m);
302302
}
@@ -596,7 +596,6 @@ void manager_free(Manager *m) {
596596
free(m->tls);
597597

598598
free(m->last_cursor);
599-
free(m->current_cursor);
600599

601600
free(m->state_file);
602601
free(m->dir);

src/netlog/netlog-manager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ struct Manager {
6666

6767
char *state_file;
6868
char *last_cursor;
69-
char *current_cursor;
7069
char *structured_data;
7170
char *dir;
7271
char *namespace;

0 commit comments

Comments
 (0)