]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/module_links.c
ccanlint: handle nested modules when mentioned in examples.
[ccan] / tools / ccanlint / tests / module_links.c
index 79aa7d1a872a6421c6fb8706142fe2df0c2b9e76..5c25e6126589ebd0cadd01d15b4fd66e8a18e11c 100644 (file)
@@ -47,7 +47,7 @@ static char *lib_list(const struct manifest *m)
        char **libs;
        char *ret = talloc_strdup(m, "");
 
-       libs = get_libs(m, m->dir, true, get_or_compile_info);
+       libs = get_libs(m, m->dir, "depends", get_or_compile_info);
        for (i = 0; libs[i]; i++)
                ret = talloc_asprintf_append(ret, "-l%s ", libs[i]);
        return ret;
@@ -58,10 +58,9 @@ static void check_use_build(struct manifest *m,
 {
        char *contents;
        char *tmpfile, *cmdout;
-       char *basename = talloc_asprintf(m, "%s/example.c", m->dir);
        int fd;
 
-       tmpfile = temp_file(m, ".c", basename);
+       tmpfile = temp_file(m, ".c", "example.c");
 
        fd = open(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600);
        if (fd < 0)
@@ -73,7 +72,7 @@ static void check_use_build(struct manifest *m,
                                   "{\n"
                                   "    return 0;\n"
                                   "}\n",
-                                  m->basename, m->basename);
+                                  m->modname, m->basename);
        if (write(fd, contents, strlen(contents)) != strlen(contents))
                err(1, "Failure writing to temporary file %s", tmpfile);
        close(fd);