(MOD) Implemented Array_Create, Array_CopyOf and Array_Delete
(MOD) Replaced project compiler from "gcc" with "clang" due to out-of-order execution keep happening after running with Array. (MOD) Removed certain functions from Utils due to insufficiencies of usage. (MOD) Defined 1 more macro "fail". (MOD) Fixed 1 bug from "var.c": Struct member "alive" was not under supervision from the entire programme cycle. (MOD) Removed 1 useless usage for "Utils_LiteraliseInteger". (MOD) Removed 1 useless block of commented code.
This commit is contained in:
@@ -1,49 +1,49 @@
|
||||
#include <Compound/utils.h>
|
||||
|
||||
int Utils_CalcDigits(long long int n)
|
||||
{
|
||||
if (n == 0) {
|
||||
return 1;
|
||||
}
|
||||
// int Utils_CalcDigits(long long int n)
|
||||
// {
|
||||
// if (n == 0) {
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
n = llabs(n);
|
||||
// n = llabs(n);
|
||||
|
||||
/* Accumulate. */
|
||||
register int i;
|
||||
for (i = 0; n; i++) n /= 10;
|
||||
// /* Accumulate. */
|
||||
// register int i;
|
||||
// for (i = 0; n; i++) n /= 10;
|
||||
|
||||
return i;
|
||||
}
|
||||
// return i;
|
||||
// }
|
||||
|
||||
int Utils_LiteraliseInteger(long long int n, char *buff)
|
||||
{
|
||||
/* Invalid buffer was presented. */
|
||||
if (strlen(buff) != LITERALISATION_LENGTH_MAXIMUM) {
|
||||
buff = NULL;
|
||||
return 0;
|
||||
}
|
||||
// int Utils_LiteraliseInteger(long long int n, char *buff)
|
||||
// {
|
||||
// /* Invalid buffer was presented. */
|
||||
// if (strlen(buff) != LITERALISATION_LENGTH_MAXIMUM) {
|
||||
// buff = NULL;
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
if (!n) {
|
||||
buff = "0";
|
||||
return 1;
|
||||
}
|
||||
// if (!n) {
|
||||
// buff = "0";
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
const int literalising_len = Utils_CalcDigits(n);
|
||||
if (literalising_len >= LITERALISATION_LENGTH_MAXIMUM) {
|
||||
buff = NULL;
|
||||
return 0;
|
||||
}
|
||||
// const int literalising_len = Utils_CalcDigits(n);
|
||||
// if (literalising_len >= LITERALISATION_LENGTH_MAXIMUM) {
|
||||
// buff = NULL;
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
char literalising[literalising_len];
|
||||
for (register int i = 0; i < literalising_len; i++) {
|
||||
literalising[i] = (n / (int)pow(10, i));
|
||||
}
|
||||
// char literalising[literalising_len];
|
||||
// for (register int i = 0; i < literalising_len; i++) {
|
||||
// literalising[i] = (n / (int)pow(10, i));
|
||||
// }
|
||||
|
||||
return literalising_len;
|
||||
}
|
||||
// return literalising_len;
|
||||
// }
|
||||
|
||||
int Utils_DateTimeLiteralise(time_t timer, char *buff,
|
||||
const char *__restrict format)
|
||||
{
|
||||
// int Utils_DateTimeLiteralise(time_t timer, char *buff,
|
||||
// const char *__restrict format)
|
||||
// {
|
||||
|
||||
}
|
||||
// }
|
||||
|
Reference in New Issue
Block a user