Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update code format with newer clang-format tool #67

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ on:
jobs:
check:
name: Check code format
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
with:
Expand Down
18 changes: 9 additions & 9 deletions add-ons/src/mender-configure.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static mender_configure_callbacks_t mender_configure_callbacks;
* @brief Mender configure keystore
*/
static mender_keystore_t *mender_configure_keystore = NULL;
static void * mender_configure_mutex = NULL;
static void *mender_configure_mutex = NULL;

/**
* @brief Mender configure artifact name
Expand Down Expand Up @@ -99,9 +99,9 @@ mender_err_t
mender_configure_init(void *config, void *callbacks) {

assert(NULL != config);
char * device_config = NULL;
cJSON * json_device_config = NULL;
char * artifact_name;
char *device_config = NULL;
cJSON *json_device_config = NULL;
char *artifact_name;
mender_err_t ret;

/* Save configuration */
Expand Down Expand Up @@ -243,9 +243,9 @@ mender_configure_get(mender_keystore_t **configuration) {
mender_err_t
mender_configure_set(mender_keystore_t *configuration) {

cJSON * json_device_config = NULL;
cJSON * json_config = NULL;
char * device_config = NULL;
cJSON *json_device_config = NULL;
cJSON *json_config = NULL;
char *device_config = NULL;
mender_err_t ret;

/* Take mutex used to protect access to the configuration key-store */
Expand Down Expand Up @@ -443,8 +443,8 @@ mender_configure_download_artifact_callback(
(void)data;
(void)index;
(void)length;
cJSON * json_device_config = NULL;
char * device_config = NULL;
cJSON *json_device_config = NULL;
char *device_config = NULL;
mender_err_t ret = MENDER_OK;

/* Check meta-data */
Expand Down
2 changes: 1 addition & 1 deletion add-ons/src/mender-inventory.c
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static mender_inventory_config_t mender_inventory_config;
* @brief Mender inventory keystore
*/
static mender_keystore_t *mender_inventory_keystore = NULL;
static void * mender_inventory_mutex = NULL;
static void *mender_inventory_mutex = NULL;

/**
* @brief Mender inventory work handle
Expand Down
34 changes: 17 additions & 17 deletions add-ons/src/mender-troubleshoot.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ typedef enum {
* Proto message header properties
*/
typedef struct {
uint16_t * terminal_width; /**< Terminal width */
uint16_t * terminal_height; /**< Terminal heigth */
char * user_id; /**< User ID */
uint32_t * timeout; /**< Timeout */
uint16_t *terminal_width; /**< Terminal width */
uint16_t *terminal_height; /**< Terminal heigth */
char *user_id; /**< User ID */
uint32_t *timeout; /**< Timeout */
mender_troubleshoot_properties_status_t *status; /**< Status */
} mender_troubleshoot_protohdr_properties_t;

Expand All @@ -108,8 +108,8 @@ typedef struct {
*/
typedef struct {
mender_troubleshoot_protohdr_type_t proto; /**< Proto type */
char * typ; /**< Message type */
char * sid; /**< Session ID */
char *typ; /**< Message type */
char *sid; /**< Session ID */
mender_troubleshoot_protohdr_properties_t *properties; /**< Properties */
} mender_troubleshoot_protohdr_t;

Expand All @@ -118,7 +118,7 @@ typedef struct {
*/
typedef struct {
mender_troubleshoot_protohdr_t *protohdr; /**< Header */
char * body; /**< Body */
char *body; /**< Body */
} mender_troubleshoot_protomsg_t;

/**
Expand Down Expand Up @@ -184,10 +184,10 @@ static mender_err_t mender_troubleshoot_mender_client_message_handler(mender_tro
* @param response Response to be sent back to the server, NULL if no response to send
* @return MENDER_OK if the function succeeds, error code if an error occured
*/
static mender_err_t mender_troubleshoot_format_acknowledgment(mender_troubleshoot_protomsg_t * protomsg,
char * sid,
static mender_err_t mender_troubleshoot_format_acknowledgment(mender_troubleshoot_protomsg_t *protomsg,
char *sid,
mender_troubleshoot_properties_status_t status,
mender_troubleshoot_protomsg_t ** response);
mender_troubleshoot_protomsg_t **response);

/**
* @brief Function called to send shell ping protomsg
Expand Down Expand Up @@ -403,7 +403,7 @@ mender_troubleshoot_shell_print(uint8_t *data, size_t length) {
assert(NULL != data);
mender_troubleshoot_protomsg_t *protomsg = NULL;
mender_err_t ret = MENDER_OK;
void * payload = NULL;
void *payload = NULL;

/* Check if a session is already opened */
if (NULL == mender_troubleshoot_shell_sid) {
Expand Down Expand Up @@ -573,7 +573,7 @@ mender_troubleshoot_data_received_callback(void *data, size_t length) {
mender_err_t ret = MENDER_OK;
mender_troubleshoot_protomsg_t *protomsg;
mender_troubleshoot_protomsg_t *response = NULL;
void * payload = NULL;
void *payload = NULL;

/* Unpack and decode message */
if (NULL == (protomsg = mender_troubleshoot_unpack_protomsg(data, length))) {
Expand Down Expand Up @@ -854,10 +854,10 @@ mender_troubleshoot_mender_client_message_handler(mender_troubleshoot_protomsg_t
}

static mender_err_t
mender_troubleshoot_format_acknowledgment(mender_troubleshoot_protomsg_t * protomsg,
char * sid,
mender_troubleshoot_format_acknowledgment(mender_troubleshoot_protomsg_t *protomsg,
char *sid,
mender_troubleshoot_properties_status_t status,
mender_troubleshoot_protomsg_t ** response) {
mender_troubleshoot_protomsg_t **response) {

assert(NULL != protomsg);
assert(NULL != protomsg->protohdr);
Expand Down Expand Up @@ -919,7 +919,7 @@ mender_troubleshoot_send_shell_ping_protomsg(void) {

mender_troubleshoot_protomsg_t *protomsg = NULL;
mender_err_t ret = MENDER_OK;
void * payload = NULL;
void *payload = NULL;
size_t length = 0;

/* Send shell ping message */
Expand Down Expand Up @@ -993,7 +993,7 @@ mender_troubleshoot_send_shell_stop_protomsg(void) {

mender_troubleshoot_protomsg_t *protomsg = NULL;
mender_err_t ret = MENDER_OK;
void * payload = NULL;
void *payload = NULL;
size_t length = 0;

/* Send shell stop message */
Expand Down
44 changes: 22 additions & 22 deletions core/src/mender-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ mender_err_t
mender_api_perform_authentication(void) {

mender_err_t ret;
char * public_key_pem = NULL;
cJSON * json_identity = NULL;
char * identity = NULL;
cJSON * json_payload = NULL;
char * payload = NULL;
char * response = NULL;
char * signature = NULL;
char *public_key_pem = NULL;
cJSON *json_identity = NULL;
char *identity = NULL;
cJSON *json_payload = NULL;
char *payload = NULL;
char *response = NULL;
char *signature = NULL;
size_t signature_length = 0;
int status = 0;

Expand Down Expand Up @@ -250,8 +250,8 @@ mender_api_check_for_deployment(char **id, char **artifact_name, char **uri) {
assert(NULL != artifact_name);
assert(NULL != uri);
mender_err_t ret;
char * path = NULL;
char * response = NULL;
char *path = NULL;
char *response = NULL;
int status = 0;

/* Compute path */
Expand Down Expand Up @@ -348,11 +348,11 @@ mender_api_publish_deployment_status(char *id, mender_deployment_status_t deploy

assert(NULL != id);
mender_err_t ret;
char * value = NULL;
cJSON * json_payload = NULL;
char * payload = NULL;
char * path = NULL;
char * response = NULL;
char *value = NULL;
cJSON *json_payload = NULL;
char *payload = NULL;
char *path = NULL;
char *response = NULL;
int status = 0;

/* Deployment status to string */
Expand Down Expand Up @@ -455,7 +455,7 @@ mender_api_download_configuration_data(mender_keystore_t **configuration) {

assert(NULL != configuration);
mender_err_t ret;
char * response = NULL;
char *response = NULL;
int status = 0;

/* Perform HTTP request */
Expand Down Expand Up @@ -506,9 +506,9 @@ mender_err_t
mender_api_publish_configuration_data(mender_keystore_t *configuration) {

mender_err_t ret;
cJSON * json_configuration = NULL;
char * payload = NULL;
char * response = NULL;
cJSON *json_configuration = NULL;
char *payload = NULL;
char *response = NULL;
int status = 0;

/* Format payload */
Expand Down Expand Up @@ -621,8 +621,8 @@ mender_err_t
mender_api_publish_inventory_data(mender_keystore_t *inventory) {

mender_err_t ret;
char * payload = NULL;
char * response = NULL;
char *payload = NULL;
char *response = NULL;
int status = 0;

/* Format payload */
Expand Down Expand Up @@ -733,9 +733,9 @@ static mender_err_t
mender_api_http_text_callback(mender_http_client_event_t event, void *data, size_t data_length, void *params) {

assert(NULL != params);
char ** response = (char **)params;
char **response = (char **)params;
mender_err_t ret = MENDER_OK;
char * tmp;
char *tmp;

/* Treatment depending of the event */
switch (event) {
Expand Down
8 changes: 4 additions & 4 deletions core/src/mender-artifact.c
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ mender_artifact_create_ctx(void) {

mender_err_t
mender_artifact_process_data(mender_artifact_ctx_t *ctx,
void * input_data,
void *input_data,
size_t input_length,
mender_err_t (*callback)(char *, cJSON *, char *, size_t, void *, size_t, size_t)) {

assert(NULL != ctx);
assert(NULL != callback);
mender_err_t ret = MENDER_OK;
void * tmp;
void *tmp;

/* Copy data to the end of the internal buffer */
if ((NULL != input_data) && (0 != input_length)) {
Expand Down Expand Up @@ -342,7 +342,7 @@ static mender_err_t
mender_artifact_check_version(mender_artifact_ctx_t *ctx) {

assert(NULL != ctx);
cJSON * object = NULL;
cJSON *object = NULL;
mender_err_t ret = MENDER_DONE;

/* Check if all data have been received */
Expand Down Expand Up @@ -402,7 +402,7 @@ static mender_err_t
mender_artifact_read_header_info(mender_artifact_ctx_t *ctx) {

assert(NULL != ctx);
cJSON * object = NULL;
cJSON *object = NULL;
mender_err_t ret = MENDER_DONE;

/* Check if all data have been received */
Expand Down
12 changes: 6 additions & 6 deletions core/src/mender-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static mender_client_state_t mender_client_state = MENDER_CLIENT_STATE_INITIALIZ
* @brief Counter and mutex for the management of network connect/release callbacks
*/
static uint8_t mender_client_network_count = 0;
static void * mender_client_network_mutex = NULL;
static void *mender_client_network_mutex = NULL;

/**
* @brief Deployment data (ID, artifact name and payload types), used to report deployment status after rebooting
Expand All @@ -112,14 +112,14 @@ typedef struct {
*/
static mender_client_artifact_type_t **mender_client_artifact_types_list = NULL;
static size_t mender_client_artifact_types_count = 0;
static void * mender_client_artifact_types_mutex = NULL;
static void *mender_client_artifact_types_mutex = NULL;

/**
* @brief Mender client add-ons list and mutex
*/
static mender_addon_instance_t **mender_client_addons_list = NULL;
static size_t mender_client_addons_count = 0;
static void * mender_client_addons_mutex = NULL;
static void *mender_client_addons_mutex = NULL;

/**
* @brief Mender client work handle
Expand Down Expand Up @@ -344,7 +344,7 @@ mender_client_register_artifact_type(char *type,
char *artifact_name) {

assert(NULL != type);
mender_client_artifact_type_t * artifact_type;
mender_client_artifact_type_t *artifact_type;
mender_client_artifact_type_t **tmp;
mender_err_t ret;

Expand Down Expand Up @@ -695,7 +695,7 @@ mender_client_work_function(void) {
static mender_err_t
mender_client_initialization_work_function(void) {

char * deployment_data = NULL;
char *deployment_data = NULL;
mender_err_t ret;

/* Retrieve or generate authentication keys */
Expand Down Expand Up @@ -1013,7 +1013,7 @@ static mender_err_t
mender_client_download_artifact_callback(char *type, cJSON *meta_data, char *filename, size_t size, void *data, size_t index, size_t length) {

assert(NULL != type);
cJSON * json_types;
cJSON *json_types;
mender_err_t ret;

/* Take mutex used to protect access to the artifact types management list */
Expand Down
2 changes: 1 addition & 1 deletion core/src/mender-utils.c
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mender_utils_http_status_to_string(int status) {
/* Definition of status strings */
const struct {
uint16_t status;
char * str;
char *str;
} desc[] = { { 100, "Continue" },
{ 101, "Switching Protocols" },
{ 103, "Early Hints" },
Expand Down
8 changes: 4 additions & 4 deletions include/mender-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ extern "C" {
*/
typedef struct {
mender_keystore_t *identity; /**< Identity of the device */
char * artifact_name; /**< Artifact name */
char * device_type; /**< Device type */
char * host; /**< URL of the mender server */
char * tenant_token; /**< Tenant token used to authenticate on the mender server (optional) */
char *artifact_name; /**< Artifact name */
char *device_type; /**< Device type */
char *host; /**< URL of the mender server */
char *tenant_token; /**< Tenant token used to authenticate on the mender server (optional) */
} mender_api_config_t;

/**
Expand Down
Loading
Loading