Commit 50276413 authored by Ivan Tyagov's avatar Ivan Tyagov

Cleanup.

parent e05da676
......@@ -6,7 +6,6 @@
#include <stdio.h>
#include <open62541/server.h>
unsigned long int getMilliSecondsSinceEpoch() {
/*
* Return milli seconds since epoch.
......@@ -21,8 +20,7 @@ unsigned long int getMilliSecondsSinceEpoch() {
*
* @param path specifies the file name given in argv[]
* @return Returns the file content after parsing */
static UA_INLINE UA_ByteString
loadFile(const char *const path) {
static UA_INLINE UA_ByteString loadFile(const char *const path) {
UA_ByteString fileContents = UA_STRING_NULL;
/* Open the file */
......@@ -49,8 +47,10 @@ loadFile(const char *const path) {
return fileContents;
}
char *randomString(size_t length)
{
char *randomString(size_t length) {
/*
* Generate a random string.
*/
static char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
char *randomString = NULL;
if (length) {
......@@ -67,7 +67,9 @@ char *randomString(size_t length)
}
char *convertInt2Str(int my_int){
/* Convert integer to string */
/*
* Convert integer to string.
*/
int length = snprintf( NULL, 0, "%d", my_int);
char *my_str = malloc(length + 1);
snprintf(my_str, length + 1, "%d", my_int);
......@@ -75,16 +77,18 @@ char *convertInt2Str(int my_int){
}
char *convertLongInt2Str(long int my_int){
/* Convert integer to string */
/*
* Convert a long integer to string.
*/
int length = snprintf( NULL, 0, "%ld", my_int);
char *my_str = malloc(length + 1);
snprintf(my_str, length + 1, "%ld", my_int);
return my_str;
}
// XXX: dictionary implementation based on https://gist.github.com/kylef/86784/fe97567ec9baf5c0dce3c7fcbec948e21dfcce09
/*
* dictionary implementation based on https://gist.github.com/kylef/86784/fe97567ec9baf5c0dce3c7fcbec948e21dfcce09
*/
typedef struct dict_t_struct {
char *key;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment