Skip to content

Commit

Permalink
[core] Minor: file scope for global var and func (#1938)
Browse files Browse the repository at this point in the history
1. sync_posix: make global variable and function file scope
2. replace static_assert by SRT_STATIC_ASSERT
  • Loading branch information
quink-black authored Apr 14, 2021
1 parent 9e6c90f commit 109f667
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2027,9 +2027,7 @@ int CUDT::processSrtMsg_HSREQ(const uint32_t *srtdata, size_t bytelen, uint32_t
return SRT_CMD_REJECT;
}

#if HAVE_CXX11
static_assert(SRT_HS_E_SIZE == SRT_HS_LATENCY + 1, "Assuming latency is the last field");
#endif
SRT_STATIC_ASSERT(SRT_HS_E_SIZE == SRT_HS_LATENCY + 1, "Assuming latency is the last field");
if (bytelen < (SRT_HS_E_SIZE * sizeof(uint32_t)))
{
// Handshake extension message includes VERSION, FLAGS and LATENCY
Expand Down
6 changes: 3 additions & 3 deletions srtcore/sync_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void rdtsc(uint64_t& x)
#endif
}

int64_t get_cpu_frequency()
static int64_t get_cpu_frequency()
{
int64_t frequency = 1; // 1 tick per microsecond.

Expand Down Expand Up @@ -123,9 +123,9 @@ static int count_subsecond_precision(int64_t ticks_per_us)
return signs;
}

const int64_t s_clock_ticks_per_us = get_cpu_frequency();
static const int64_t s_clock_ticks_per_us = get_cpu_frequency();

const int s_clock_subsecond_precision = count_subsecond_precision(s_clock_ticks_per_us);
static const int s_clock_subsecond_precision = count_subsecond_precision(s_clock_ticks_per_us);

int clockSubsecondPrecision() { return s_clock_subsecond_precision; }

Expand Down

0 comments on commit 109f667

Please sign in to comment.