Re: [PATCH] test-drop-caches: mark file local symbols with static
- From
Ben Peart <peartben@gmail.com>
- Date
- Sep 18, 2017, 12:32 UTC
- Message-ID
- <756cf0ba-aad8-3fdb-298a-f174394e5895@gmail.com>
- In-Reply-To
- <762d317b-8174-1809-a077-38b036850d3f@ramsayjones.plus.com>
On 9/17/2017 12:14 PM, Ramsay Jones wrote:
Show 9 quoted lines
> > Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> > --- > > Hi Ben, > > If you need to re-roll your 'bp/fsmonitor' branch, could you please > squash this into the relevant patch (commit c6b5a28941, "fsmonitor: > add a performance test", 15-09-2017).
Absolutely. Thanks!
I'd really appreciate some feedback on whether this works properly on platform other than Windows.
Show 84 quoted lines
>
> Thanks!
>
> ATB,
> Ramsay Jones
>
> t/helper/test-drop-caches.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/t/helper/test-drop-caches.c b/t/helper/test-drop-caches.c
> index 717079865..17590170f 100644
> --- a/t/helper/test-drop-caches.c
> +++ b/t/helper/test-drop-caches.c
> @@ -2,7 +2,7 @@
>
> #if defined(GIT_WINDOWS_NATIVE)
>
> -int cmd_sync(void)
> +static int cmd_sync(void)
> {
> char Buffer[MAX_PATH];
> DWORD dwRet;
> @@ -49,7 +49,7 @@ typedef enum _SYSTEM_MEMORY_LIST_COMMAND {
> MemoryCommandMax
> } SYSTEM_MEMORY_LIST_COMMAND;
>
> -BOOL GetPrivilege(HANDLE TokenHandle, LPCSTR lpName, int flags)
> +static BOOL GetPrivilege(HANDLE TokenHandle, LPCSTR lpName, int flags)
> {
> BOOL bResult;
> DWORD dwBufferLength;
> @@ -77,7 +77,7 @@ BOOL GetPrivilege(HANDLE TokenHandle, LPCSTR lpName, int flags)
> return bResult;
> }
>
> -int cmd_dropcaches(void)
> +static int cmd_dropcaches(void)
> {
> HANDLE hProcess = GetCurrentProcess();
> HANDLE hToken;
> @@ -118,36 +118,36 @@ int cmd_dropcaches(void)
>
> #elif defined(__linux__)
>
> -int cmd_sync(void)
> +static int cmd_sync(void)
> {
> return system("sync");
> }
>
> -int cmd_dropcaches(void)
> +static int cmd_dropcaches(void)
> {
> return system("echo 3 | sudo tee /proc/sys/vm/drop_caches");
> }
>
> #elif defined(__APPLE__)
>
> -int cmd_sync(void)
> +static int cmd_sync(void)
> {
> return system("sync");
> }
>
> -int cmd_dropcaches(void)
> +static int cmd_dropcaches(void)
> {
> return system("sudo purge");
> }
>
> #else
>
> -int cmd_sync(void)
> +static int cmd_sync(void)
> {
> return 0;
> }
>
> -int cmd_dropcaches(void)
> +static int cmd_dropcaches(void)
> {
> return error("drop caches not implemented on this platform");
> }
>