From 070b5c400b3a384c71cace537f945cad9b02bf52 Mon Sep 17 00:00:00 2001
From: Petter Reinholdtsen <pere@debian.org>
Date: Fri, 7 Mar 2025 07:34:33 +0100
Subject: [PATCH] Dropped passing dummy variable to select() in example, use
 NULL instead.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Both POSIX, the Linux documentation and UNIX Network Programming volume 1
by Stephens state that NULL is accepted.

This avoid the following compiler message:

../../examples/player_example.c: In function ‘main’:
../../examples/player_example.c:839:22: warning: passing argument 2 to ‘restrict’-qualified parameter aliases with argument 4 [-Werror=restrict]
  839 |           n=select(n,&empty,&writefs,&empty,&timeout);
      |                      ^~~~~~          ~~~~~~
../../examples/player_example.c:843:18: warning: passing argument 2 to ‘restrict’-qualified parameter aliases with argument 4 [-Werror=restrict]
  843 |         select(n,&empty,&writefs,&empty,NULL);
      |                  ^~~~~~          ~~~~~~
---
 examples/player_example.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/examples/player_example.c b/examples/player_example.c
index 18fbdd1f..baafe03d 100644
--- a/examples/player_example.c
+++ b/examples/player_example.c
@@ -809,11 +809,9 @@ int main(int argc,char *const *argv){
       /* set up select wait on the audiobuffer and a timeout for video */
       struct timeval timeout;
       fd_set writefs;
-      fd_set empty;
       int n=0;
 
       FD_ZERO(&writefs);
-      FD_ZERO(&empty);
       if(audiofd>=0){
         FD_SET(audiofd,&writefs);
         n=audiofd+1;
@@ -836,11 +834,11 @@ int main(int argc,char *const *argv){
           timeout.tv_sec=milliseconds/1000;
           timeout.tv_usec=(milliseconds%1000)*1000;
 
-          n=select(n,&empty,&writefs,&empty,&timeout);
+          n=select(n,NULL,&writefs,NULL,&timeout);
           if(n)audio_calibrate_timer(0);
         }
       }else{
-        select(n,&empty,&writefs,&empty,NULL);
+        select(n,NULL,&writefs,NULL,NULL);
       }
     }
 
-- 
GitLab