Skip to content

Commit 18805c4

Browse files
committed
Don't typedef the struct in C exe projects
1 parent 2059dbf commit 18805c4

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

cmake-init/templates/c/executable/source/lib.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
static const char json[] = "{\"name\":\"{= name =}\"}";{% end %}
1111

12-
library create_library()
12+
struct library create_library()
1313
{
14-
library lib;{% if pm %}
14+
struct library lib;{% if pm %}
1515
struct json_tokener* tokener = NULL;
1616
struct json_object* object = NULL;
1717
struct json_object* name_object = NULL;
@@ -58,7 +58,7 @@ library create_library()
5858
return lib;
5959
}{% if pm %}
6060

61-
void destroy_library(library* lib)
61+
void destroy_library(struct library* lib)
6262
{
6363
free(HEDLEY_CONST_CAST(void*, lib->name));
6464
}{% end %}

cmake-init/templates/c/executable/source/lib.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
/**
44
* @brief Simply initializes the name member to the name of the project
55
*/
6-
typedef struct library {
6+
struct library {
77
const char* name;
8-
} library;
8+
};
99

1010
/**
1111
* @brief Creates an instance of library with the name of the project
1212
*/
13-
library create_library(void);{% if pm %}
13+
struct library create_library(void);{% if pm %}
1414

1515
/**
1616
* @brief Destroys resources held by the library
1717
*/
18-
void destroy_library(library* lib);{% end %}
18+
void destroy_library(struct library* lib);{% end %}

cmake-init/templates/c/executable/source/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
int main(int argc, const char* argv[])
77
{
8-
library lib = create_library();
8+
struct library lib = create_library();
99

1010
(void)argc;
1111
(void)argv;

cmake-init/templates/c/executable/test/source/__name___test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ TEST_CASE("Name is {= name =}", "[library]")
1717
}{% else %}
1818
int main(int argc, const char* argv[])
1919
{
20-
library lib = create_library();
20+
struct library lib = create_library();
2121

2222
(void)argc;
2323
(void)argv;

0 commit comments

Comments
 (0)