From 50859b8d1e65a78e62f33ffd19b3e8022cd540a4 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Thu, 11 Jan 2024 12:18:52 -0700 Subject: [PATCH] Moved variable initialization out of header file --- include/ply.h | 39 ++++----------------------------------- src/ply.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/include/ply.h b/include/ply.h index 4671a85..1dca460 100644 --- a/include/ply.h +++ b/include/ply.h @@ -48,41 +48,10 @@ typedef struct PlyElementStruct { struct PlyElementStruct* next; } PlyElement; - -const char* const ply_formats[] = { - "ascii", - "binary_little_endian", - "binary_big_endian" -}; - -const char* const ply_header_items[] = { - "comment", - "end_header", - "element", - "property", -}; - -const char* const ply_type_strings[] = { - "char", - "uchar", - "short", - "ushort", - "int", - "uint", - "float", - "double", -}; - -size_t ply_type_sizes[] = { - 1, - 1, - 2, - 2, - 4, - 4, - 4, - 8, -}; +extern const char* const ply_formats[]; +extern const char* const ply_header_items[]; +extern const char* const ply_type_strings[]; +extern const size_t ply_type_sizes[]; PlyElement* ply_load_mesh(char* filename); void ply_free_mesh(PlyElement* elements_head); diff --git a/src/ply.c b/src/ply.c index e83dda4..bd01f67 100644 --- a/src/ply.c +++ b/src/ply.c @@ -3,6 +3,41 @@ #include #include +const char* const ply_formats[] = { + "ascii", + "binary_little_endian", + "binary_big_endian" +}; + +const char* const ply_header_items[] = { + "comment", + "end_header", + "element", + "property", +}; + +const char* const ply_type_strings[] = { + "char", + "uchar", + "short", + "ushort", + "int", + "uint", + "float", + "double", +}; + +const size_t ply_type_sizes[] = { + 1, + 1, + 2, + 2, + 4, + 4, + 4, + 8, +}; + PlyPropertyType ply_parse_type(const char* type_string) { for(uint32_t i = 0; i < sizeof(ply_type_strings)/sizeof(char*); i++) { if(strcmp(ply_type_strings[i], type_string) == 0) {