Ledda 2 semanas atrás
pai
commit
5f0eaedfc6
2 arquivos alterados com 11 adições e 5 exclusões
  1. +10
    -4
      app.cpp
  2. +1
    -1
      core.cpp

+ 10
- 4
app.cpp Ver arquivo

@@ -1,4 +1,4 @@
#include <math.h>
#include <stdio.h>
#include "core.cpp"

int main(int argc, char **argv) {
@@ -7,9 +7,15 @@ int main(int argc, char **argv) {
Arena *arena = arenaAlloc(Megabytes(64));
list<string> args = getArgs(arena, argc, argv);

{
log("teststr: %S :teststrend", strlit("teststring hahaha"));
};
log(strSplit(arena, strlit("-"), strlit("hallo-world")));

while (true) {
size_t arenaPos = arena->head;
string line = PushString(arena, 128);
fgets(line.str, (int)line.length, stdin);
log(strSplit(arena, strlit("-"), line));
arenaFreeFrom(arena, arenaPos);
}

return statusCode;
}

+ 1
- 1
core.cpp Ver arquivo

@@ -222,7 +222,7 @@ list<string> strSplit(Arena *arena, string splitStr, string inputStr) {
size_t start = 0;
void *beginning = (char *)arena->memory + arena->head;
while (c < inputStr.length - splitStr.length) {
if (strEql(strSlice(inputStr, c, splitStr.length), splitStr)) {
if (strEql(strSlice(inputStr, c, c + splitStr.length), splitStr)) {
string *splitString = PushStruct(arena, string);
splitString->str = inputStr.str + start;
splitString->length = c - start;


Carregando…
Cancelar
Salvar