Skip to content

Commit

Permalink
cleanup: Remove unnecessary assert and includes
Browse files Browse the repository at this point in the history
This assert can give odd compile errors and is unnecessary.
We can easily prove that sizeof(ret->name) is <= sizeof(buf)
as sizeof(buf) includes sizeof(ret->name)
  • Loading branch information
JFreegman committed Dec 31, 2023
1 parent 57d330c commit 3add8b8
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/audio_call.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "video_call.h"
#endif /* VIDEO */

#include <assert.h>
#include <curses.h>
#include <pthread.h>
#include <stdbool.h>
Expand Down
1 change: 0 additions & 1 deletion src/audio_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <AL/alext.h>
#endif /* ALC_ALL_DEVICES_SPECIFIER */

#include <assert.h>
#include <math.h>
#include <pthread.h>
#include <stdbool.h>
Expand Down
1 change: 0 additions & 1 deletion src/chat.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#define _GNU_SOURCE /* needed for wcswidth() */
#endif

#include <assert.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
Expand Down
1 change: 0 additions & 1 deletion src/conference.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#define _GNU_SOURCE /* needed for strcasestr() and wcswidth() */
#endif

#include <assert.h>
#include <inttypes.h>
#include <math.h>
#include <stdlib.h>
Expand Down
1 change: 0 additions & 1 deletion src/execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*
*/

#include <assert.h>
#include <stdlib.h>
#include <string.h>

Expand Down
1 change: 0 additions & 1 deletion src/friendlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/

#include <arpa/inet.h>
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
Expand Down
3 changes: 0 additions & 3 deletions src/game_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*
*/

#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -924,8 +923,6 @@ static ToxWindow *game_new_window(Tox *m, GameType type, uint32_t friendnumber)

const size_t name_size = sizeof(ret->name);

assert(name_size != 0 && name_size <= sizeof(buf));

buf[name_size - 1] = '\0';

snprintf(ret->name, name_size, "%s", buf);
Expand Down
1 change: 0 additions & 1 deletion src/groupchats.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <wchar.h>
#include <unistd.h>
Expand Down
1 change: 0 additions & 1 deletion src/notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*
*/

#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
Expand Down
1 change: 0 additions & 1 deletion src/osx_video.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>

/*
* Helper video format functions
Expand Down
1 change: 0 additions & 1 deletion src/video_call.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "video_device.h"
#include "windows.h"

#include <assert.h>
#include <curses.h>
#include <pthread.h>
#include <stdbool.h>
Expand Down

0 comments on commit 3add8b8

Please sign in to comment.