mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-17 09:25:44 +01:00
remove types.h, and start using intdef.h
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../util/compat/endian.h"
|
#include "../util/compat/endian.h"
|
||||||
#include "../util/types.h"
|
#include "../util/intdef.h"
|
||||||
|
|
||||||
int nbt_primsize(u8 tag) {
|
int nbt_primsize(u8 tag) {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "../util/atrb.h"
|
#include "../util/atrb.h"
|
||||||
#include "../util/compat/endian.h"
|
#include "../util/compat/endian.h"
|
||||||
#include "../util/types.h"
|
#include "../util/intdef.h"
|
||||||
|
|
||||||
/* NBT (named binary tag) is a tree data structure. Tags have a numeric type ID, name and a payload.
|
/* NBT (named binary tag) is a tree data structure. Tags have a numeric type ID, name and a payload.
|
||||||
* NBT files are a compressed `compound` tag. GZip is the compression used in most cases,
|
* NBT files are a compressed `compound` tag. GZip is the compression used in most cases,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "../error.h"
|
#include "../error.h"
|
||||||
#include "../util/types.h"
|
#include "../util/intdef.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
|
|
||||||
#define VERTC 3
|
#define VERTC 3
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
#include "../error.h"
|
#include "../error.h"
|
||||||
#include "atrb.h"
|
#include "atrb.h"
|
||||||
#include "types.h"
|
#include "intdef.h"
|
||||||
|
|
||||||
int conf_procbuf(char const *restrict buf, char *restrict kout, char *restrict vout, size_t len) {
|
int conf_procbuf(const char *restrict buf, char *restrict kout, char *restrict vout, size_t len) {
|
||||||
bool feq = false; // whether we've found the equal sign
|
bool feq = false; // whether we've found the equal sign
|
||||||
|
|
||||||
// data traversal
|
// data traversal
|
||||||
@@ -53,7 +53,7 @@ int conf_procbuf(char const *restrict buf, char *restrict kout, char *restrict v
|
|||||||
return (pos == kout) ? CONF_ENODAT : (!feq ? CONF_ESYNTAX : 0);
|
return (pos == kout) ? CONF_ENODAT : (!feq ? CONF_ESYNTAX : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct conf_entry const *conf_matchopt(struct conf_entry const *opts, size_t optc, char const *restrict key) {
|
struct conf_entry const *conf_matchopt(struct conf_entry const *opts, size_t optc, const char *restrict key) {
|
||||||
// find a match for the current key
|
// find a match for the current key
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (; i < optc; i++) {
|
for (; i < optc; i++) {
|
||||||
@@ -63,7 +63,7 @@ struct conf_entry const *conf_matchopt(struct conf_entry const *opts, size_t opt
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int conf_procval(struct conf_entry const *opt, char const *restrict val) {
|
int conf_procval(struct conf_entry const *opt, const char *restrict val) {
|
||||||
// parse the data
|
// parse the data
|
||||||
errno = 0;
|
errno = 0;
|
||||||
char *end;
|
char *end;
|
||||||
@@ -127,7 +127,8 @@ int conf_procval(struct conf_entry const *opt, char const *restrict val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* utility function for conf_getpat to concatenate 3 strings, where we already know the size */
|
/* utility function for conf_getpat to concatenate 3 strings, where we already know the size */
|
||||||
NONNULL(1, 3) static char *conf_getpat_concat(char const *restrict s1, char const *restrict s2, char const *restrict s3, size_t s1len, size_t s2len, size_t s3len) {
|
NONNULL(1, 3)
|
||||||
|
static char *conf_getpat_concat(const char *restrict s1, const char *restrict s2, const char *restrict s3, size_t s1len, size_t s2len, size_t s3len) {
|
||||||
assert(s2 || (!s2 && !s2len)); // ensuring the programmer passes both s2 and s2len as 0, if they intend to
|
assert(s2 || (!s2 && !s2len)); // ensuring the programmer passes both s2 and s2len as 0, if they intend to
|
||||||
char *buf, *ptr;
|
char *buf, *ptr;
|
||||||
|
|
||||||
@@ -146,7 +147,7 @@ NONNULL(1, 3) static char *conf_getpat_concat(char const *restrict s1, char cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* appends str to the config directory string we acquire from environment variables. */
|
/* appends str to the config directory string we acquire from environment variables. */
|
||||||
char *conf_getpat(char const *restrict str) {
|
char *conf_getpat(const char *restrict str) {
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
size_t len;
|
size_t len;
|
||||||
size_t str_len = strlen(str);
|
size_t str_len = strlen(str);
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "atrb.h"
|
#include "atrb.h"
|
||||||
|
#include "intdef.h"
|
||||||
|
|
||||||
/* error codes */
|
/* error codes */
|
||||||
enum conf_err {
|
enum conf_err {
|
||||||
@@ -43,7 +43,7 @@ struct conf_fstr {
|
|||||||
struct conf_entry {
|
struct conf_entry {
|
||||||
const char *key; // the key of this entry
|
const char *key; // the key of this entry
|
||||||
void *out; // the pointer to which the data is written value is read if the given option is incorrect or missing
|
void *out; // the pointer to which the data is written value is read if the given option is incorrect or missing
|
||||||
uint8_t type; // the primitive type which we are querying for
|
u8 type; // the primitive type which we are querying for
|
||||||
};
|
};
|
||||||
|
|
||||||
/* processes an incoming buffer.
|
/* processes an incoming buffer.
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
intdef.h
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "types.h"
|
#include "intdef.h"
|
||||||
|
|
||||||
#if defined(__has_attribute) && __has_attribute(vector_size)
|
#if defined(__has_attribute) && __has_attribute(vector_size)
|
||||||
typedef float fvec2 __attribute__((vector_size(sizeof(float) * 2))); // SMID vector for 2 `float`
|
typedef float fvec2 __attribute__((vector_size(sizeof(float) * 2))); // SMID vector for 2 `float`
|
||||||
|
|||||||
Reference in New Issue
Block a user