Skip to content

Commit

Permalink
Update CPJ_ZSTR_ARG
Browse files Browse the repository at this point in the history
  • Loading branch information
lygstate committed Dec 17, 2024
1 parent f4a6415 commit 333c2fa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions include/cpj.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#if defined(_WIN32) || defined(__CYGWIN__)
#define CPJ_EXPORT __declspec(dllexport)
Expand Down Expand Up @@ -34,14 +35,15 @@ extern "C"

typedef char cpj_char_t;
typedef size_t cpj_size_t;
#define CPJ_SIZE_MAX SIZE_MAX

/**
* Description of a JerryScript string for arguments passing
*/
typedef struct
{
const cpj_char_t
*ptr; /**< pointer to the zero-terminated ASCII/UTF-8/CESU-8 string */
/**< pointer to the zero-terminated ASCII/UTF-8/CESU-8 string */
const cpj_char_t *ptr;
cpj_size_t size; /**< size of the string, excluding '\0' terminator */
} cpj_string_t;

Expand Down Expand Up @@ -85,7 +87,7 @@ typedef enum
} cpj_path_style_t;

/**
* Helper to to ensure str is a string literal
* Helper to generate a string literal with type const cpj_char_t *
*/
#define CPJ_ZSTR_LITERAL(str) (const cpj_char_t *)(str "")

Expand All @@ -94,7 +96,7 @@ typedef enum
* pair.
*/
#define CPJ_ZSTR_ARG(str) \
((CPJ_ZSTR_LITERAL(str))), ((cpj_size_t)(sizeof(str) - 1))
(CPJ_ZSTR_LITERAL(str)), ((cpj_size_t)(sizeof(str) - 1))

/**
* @brief Generates an absolute path based on a base.
Expand Down

0 comments on commit 333c2fa

Please sign in to comment.