You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/03/24 22:36:12 UTC

[GitHub] [incubator-nuttx] codebje commented on a change in pull request #3170: Move getopt() variables into TLS

codebje commented on a change in pull request #3170:
URL: https://github.com/apache/incubator-nuttx/pull/3170#discussion_r600918629



##########
File path: libs/libc/unistd/lib_getopt.c
##########
@@ -128,11 +134,11 @@ int getopt(int argc, FAR char * const argv[], FAR const char *optstring)
        * the program, optind must be reset to some value <= 1.
        */
 
-      if (optind < 1 || !g_binitialized)
+      if (go->go_optind < 1 || !g_binitialized)
         {
-          optarg         = NULL;
-          optind         = 1;     /* Skip over the program name */
-          optopt         = '?';
+          go->go_optarg  = NULL;
+          go->go_optind  = 1;     /* Skip over the program name */
+          go->go_optopt  = '?';
           g_optptr       = NULL;  /* Start at the beginning of the first argument */
           g_binitialized = true;  /* Now we are initialized */

Review comment:
       `g_optptr`, `g_argv`, `g_argc`, and `g_binitialized` also need to be in TLS.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org