-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
64 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwJSON - Lightweight JSON format parser. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWJSON_HDR_OPTS_H | ||
#define LWJSON_HDR_OPTS_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwJSON - Lightweight JSON format parser. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWJSON_HDR_H | ||
#define LWJSON_HDR_H | ||
|
@@ -192,6 +192,34 @@ lwjson_get_val_string(const lwjson_token_t* token, size_t* str_len) { | |
*/ | ||
#define lwjson_get_val_string_length(token) ((size_t)(((token) != NULL && (token)->type == LWJSON_TYPE_STRING) ? (token)->u.str.token_value_len : 0)) | ||
|
||
/** | ||
* \brief Compare string token with user input string for a case-sensitive match | ||
* \param[in] token: Token with string type | ||
* \param[out] str: String to compare | ||
* \return `1` if equal, `0` otherwise | ||
*/ | ||
static inline uint8_t | ||
lwjson_string_compare(const lwjson_token_t* token, const char* str) { | ||
if (token != NULL && token->type == LWJSON_TYPE_STRING) { | ||
return strncmp(token->u.str.token_value, str, token->u.str.token_value_len) == 0; | ||
} | ||
return 0; | ||
} | ||
|
||
/** | ||
* \brief Compare string token with user input string for a case-sensitive match | ||
* \param[in] token: Token with string type | ||
* \param[out] str: String to compare | ||
* \return `1` if equal, `0` otherwise | ||
*/ | ||
static inline uint8_t | ||
lwjson_string_compare_n(const lwjson_token_t* token, const char* str, size_t len) { | ||
if (token != NULL && token->type == LWJSON_TYPE_STRING && len <= token->u.str.token_value_len) { | ||
return strncmp(token->u.str.token_value, str, len) == 0; | ||
} | ||
return 0; | ||
} | ||
|
||
/** | ||
* \} | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwJSON - Lightweight JSON format parser. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWJSON_HDR_OPT_H | ||
#define LWJSON_HDR_OPT_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwJSON - Lightweight JSON format parser. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWJSON_HDR_OPTS_H | ||
#define LWJSON_HDR_OPTS_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwJSON - Lightweight JSON format parser. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#include <string.h> | ||
#include "lwjson/lwjson.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwJSON - Lightweight JSON format parser. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#include <string.h> | ||
#include <stdio.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters