embedded: reduce stack usage
authorØyvind Harboe <oyvind.harboe@zylin.com>
Sat, 21 Nov 2009 22:29:58 +0000 (23:29 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Sun, 22 Nov 2009 12:38:42 +0000 (13:38 +0100)
Allocate working structures on stack to avoid issues with
path lengths + reduce stack usage.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/helper/configuration.c

index 2ea5da480cb81cc26b2bc95581c5165db1d93d11..007246c58b9cc2042c2c9b464a42bbf056ccf22d 100644 (file)
@@ -61,21 +61,23 @@ char *find_file(const char *file)
        char **search_dirs = script_search_dirs;
        char *dir;
        char const *mode="r";
-       char full_path[1024];
+       char *full_path;
 
        /* Check absolute and relative to current working dir first.
         * This keeps full_path reporting belowing working. */
-       snprintf(full_path, 1024, "%s", file);
+       full_path = alloc_printf("%s", file);
        fp = fopen(full_path, mode);
 
        while (!fp)
        {
+               free(full_path);
+               full_path = NULL;
                dir = *search_dirs++;
 
                if (!dir)
                        break;
 
-               snprintf(full_path, 1024, "%s/%s", dir, file);
+               full_path = alloc_printf("%s/%s", dir, file);
                fp = fopen(full_path, mode);
        }
 
@@ -83,8 +85,11 @@ char *find_file(const char *file)
        {
                fclose(fp);
                LOG_DEBUG("found %s", full_path);
-               return strdup(full_path);
+               return full_path;
        }
+
+       free(full_path);
+
        return NULL;
 }
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)