Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevaev committed Feb 29, 2024
1 parent ca36383 commit 7bacef7
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion janus/src/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ static void *_video_sink_thread(void *arg) {

close_memsink:
US_DELETE(mem, us_memsink_shared_unmap);
US_CLOSE_FD(fd, close);
US_CLOSE_FD(fd);
US_JLOG_INFO("video", "Memsink closed");
sleep(1); // error_delay
}
Expand Down
2 changes: 1 addition & 1 deletion linters/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ commands = cppcheck \
--std=c17 \
--error-exitcode=1 \
--quiet \
--enable=warning,unusedFunction,portability,performance,style \
--enable=warning,portability,performance,style \
--suppress=assignmentInAssert \
--suppress=variableScope \
--inline-suppr \
Expand Down
4 changes: 2 additions & 2 deletions python/src/ustreamer.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ typedef struct {

static void _MemsinkObject_destroy_internals(_MemsinkObject *self) {
US_DELETE(self->mem, us_memsink_shared_unmap);
US_CLOSE_FD(self->fd, close);
US_CLOSE_FD(self->fd);
US_DELETE(self->frame, us_frame_destroy);
}

Expand Down Expand Up @@ -285,7 +285,7 @@ static PyModuleDef _Module = {
.m_size = -1,
};

PyMODINIT_FUNC PyInit_ustreamer(void) { // cppcheck-suppress unusedFunction
PyMODINIT_FUNC PyInit_ustreamer(void) {
PyObject *module = PyModule_Create(&_Module);
if (module == NULL) {
return NULL;
Expand Down
6 changes: 3 additions & 3 deletions src/libs/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void us_device_close(us_device_s *dev) {
for (uint index = 0; index < run->n_bufs; ++index) {
us_hw_buffer_s *hw = &run->hw_bufs[index];

US_CLOSE_FD(hw->dma_fd, close);
US_CLOSE_FD(hw->dma_fd);

if (dev->io_method == V4L2_MEMORY_MMAP) {
if (hw->raw.allocated > 0 && hw->raw.data != NULL) {
Expand All @@ -254,7 +254,7 @@ void us_device_close(us_device_s *dev) {
run->n_bufs = 0;
}

US_CLOSE_FD(run->fd, close);
US_CLOSE_FD(run->fd);
run->persistent_timeout_reported = false;
}

Expand Down Expand Up @@ -920,7 +920,7 @@ static int _device_open_export_to_dma(us_device_s *dev) {

error:
for (uint index = 0; index < run->n_bufs; ++index) {
US_CLOSE_FD(run->hw_bufs[index].dma_fd, close);
US_CLOSE_FD(run->hw_bufs[index].dma_fd);
}
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/memsink.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ int us_memsink_server_put(us_memsink_s *sink, const us_frame_s *frame, bool *key
return 0;
}

int us_memsink_client_get(us_memsink_s *sink, us_frame_s *frame, bool *key_requested, bool key_required) { // cppcheck-suppress unusedFunction
int us_memsink_client_get(us_memsink_s *sink, us_frame_s *frame, bool *key_requested, bool key_required) {
assert(!sink->server); // Client only

if (us_flock_timedwait_monotonic(sink->fd, sink->timeout) < 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#define US_CALLOC(x_dest, x_nmemb) assert(((x_dest) = calloc((x_nmemb), sizeof(*(x_dest)))) != NULL)
#define US_REALLOC(x_dest, x_nmemb) assert(((x_dest) = realloc((x_dest), (x_nmemb) * sizeof(*(x_dest)))) != NULL)
#define US_DELETE(x_dest, x_free) { if (x_dest) { x_free(x_dest); x_dest = NULL; } }
#define US_CLOSE_FD(x_dest, x_close) { if (x_dest >= 0) { x_close(x_dest); x_dest = -1; } }
#define US_CLOSE_FD(x_dest) { if (x_dest >= 0) { close(x_dest); x_dest = -1; } }
#define US_MEMSET_ZERO(x_obj) memset(&(x_obj), 0, sizeof(x_obj))

#define US_SNPRINTF(x_dest, x_size, x_fmt, ...) assert(snprintf((x_dest), (x_size), (x_fmt), ##__VA_ARGS__) > 0)
Expand Down
4 changes: 2 additions & 2 deletions src/ustreamer/http/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void us_server_destroy(us_server_s *server) {
}

evhttp_free(run->http);
US_CLOSE_FD(run->ext_fd, close);
US_CLOSE_FD(run->ext_fd);
event_base_free(run->base);

# if LIBEVENT_VERSION_NUMBER >= 0x02010100
Expand Down Expand Up @@ -392,7 +392,7 @@ static void _http_callback_static(struct evhttp_request *request, void *v_server
goto cleanup;

cleanup:
US_CLOSE_FD(fd, close); // cppcheck-suppress unreadVariable
US_CLOSE_FD(fd); // cppcheck-suppress unreadVariable
US_DELETE(static_path, free);
US_DELETE(buf, evbuffer_free);
US_DELETE(decoded_path, free);
Expand Down
6 changes: 3 additions & 3 deletions src/v4p/drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ static void _drm_cleanup(us_drm_s *drm) {
run->n_bufs = 0;
}

US_CLOSE_FD(run->status_fd, close);
US_CLOSE_FD(run->fd, close);
US_CLOSE_FD(run->status_fd);
US_CLOSE_FD(run->fd);

run->crtc_id = 0;
run->next_n_buf = 0;
Expand Down Expand Up @@ -391,7 +391,7 @@ static int _drm_check_status(us_drm_s *drm) {
return (status_ch == 'd' ? -2 : 0);

error:
US_CLOSE_FD(run->status_fd, close);
US_CLOSE_FD(run->status_fd);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/v4p/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ static void *_follower_thread(void *v_unix_follow) {

const bool online = !connect(fd, (struct sockaddr *)&addr, sizeof(addr));
atomic_store(&_g_ustreamer_online, online);
US_CLOSE_FD(fd, close); // cppcheck-suppress unreadVariable
US_CLOSE_FD(fd); // cppcheck-suppress unreadVariable

usleep(200 * 1000);
}
Expand Down

0 comments on commit 7bacef7

Please sign in to comment.