C string parser criticism – Code Review Stack Exchange

I have written a program to parse a string depending on the string the user provides.
Any advise/criticism is appreciated.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>

#define DEFAULT_SIZE 10
#define RESIZE_MULTI 2

/*compares value to see if it exists in parse. return 0 if exists*/
static uint8_t compare(const char value, const char *parse)
{
   size_t i;

   i = 0;
   while(*(parse + i) != '')
   {
      if(*(parse + i) == value)
         return 0;
      i++;
   }
   return 1;
}

/*string must be null terminated. the string that needs to be split*/
/*parse must be null terminated. contains value that the string will be split at*/
/*matrix contains all the string that was split based on parse. the function return how how many string there are*/
size_t parse_string(const char *string, const char *parse, char *** const user_matrix)
{
   /*how many spots there are*/
   size_t temp_matrix_size;
   /*how many acctually string there are*/
   size_t temp_matrix_length;
   char **temp_matrix;
   size_t i;
   size_t counter;

   /*allocate initial memory. array of pointers*/
   temp_matrix = malloc(sizeof(*temp_matrix) * DEFAULT_SIZE);
   if(temp_matrix == NULL)
      goto FAIL0;
   temp_matrix_size = DEFAULT_SIZE;
   /*since right now there 0 string aka pointers to strings*/
   temp_matrix_length = 0;


   i = counter = 0;
   while(*(string + i) != '')
   {
      /*resize array of pointers*/
      if(temp_matrix_length >= temp_matrix_size)
      {
         char **temp = realloc(temp_matrix, sizeof(*temp_matrix) * temp_matrix_size * RESIZE_MULTI);
         if(temp == NULL)
            goto FAIL0;
         temp_matrix = temp;
         temp_matrix_size = temp_matrix_size * RESIZE_MULTI;
      }

      if(compare(*(string + i), parse) == 0)
      {
         char *temp;
         if(counter > 0)
         {
            /*need the plus 1 for terminating char*/
            temp = malloc(sizeof(*temp) * (counter + 1));
            if(temp == NULL)
               goto FAIL0;

            /*setting terminating char*/
            *(temp + counter) = '';
            /*copy over the string before the parsing char*/
            memcpy(temp, string + (i - counter), counter);

            /*store the string*/
            *(temp_matrix + temp_matrix_length) = temp;
            temp_matrix_length++;
         }

         /*store only the parsing char with null terminated char*/
         temp = malloc(sizeof(*temp) * 2);
         if(temp == NULL)
            goto FAIL0;
         *(temp + 0) = *(string + i);
         *(temp + 1) = '';

         *(temp_matrix + temp_matrix_length) = temp;
         temp_matrix_length++;

         i++;
         counter = 0;
      }
      else
      {
         i++;
         counter++;
      }
   }

   /*special case*/
   if(counter != 0)
   {
      char *temp = malloc(sizeof(*temp) * (counter + 1));
      if(temp == NULL)
         goto FAIL0;

      /*setting terminating char*/
      *(temp + counter) = '';
      /*copy over the string before the parsing char*/
      memcpy(temp, string + (i - counter), counter);

      /*store the string*/
      *(temp_matrix + temp_matrix_length) = temp;
      temp_matrix_length++;
   }

   *user_matrix = temp_matrix;

   return temp_matrix_length;

   FAIL0:
   if(temp_matrix != NULL)
   {
      /*free all the strings*/
      for(i = 0; i < temp_matrix_length; i++)
      {
         free(*(temp_matrix + i));
      }
      /*free the array of pointers*/
      free(temp_matrix);
   }
   *user_matrix = NULL;
   return 0;
}

int main(void)
{
   char **matrix;
   size_t size;

   /*can have anything you want*/
   char *str = "Hello Word!!!";
   /*can have any char you want*/
   char *parse = "! ";

   size = parse_string(str, parse, &matrix);

   for(size_t i = 0; i < size; i++)
   {
      printf("%sn", *(matrix + i));
   }

   for(size_t i = 0; i < size; i++)
   {
      free(*(matrix + i));
   }
   free(matrix);

   return 0;
}

[NSFW] Review: Pornkind.net

Let me know your thoughts and any changes could be made to improve.

Download Links and descriptions available for ALL content!

Demo Video Page: https://pornkind.net/nia-nacci-ebony-queen-enjoy-this-full-romp-with-this-caramel-goddess/

Any missing Premium Studios? Comment below and they will be added!

[NSFW] Review my Sites [MERGED] : StepFantasyPorn.com | Proxies-free

Its a Wp-Script them.
Change background.
Remove reply to post to prevent spam.
Work more on style of the website.
Change footer description. Make good footer friendly seo description of your site.
Dont embed videos from other tubes, upload and embed video from other video host check here for free video hosts https://www.wjunction.com/forums/file-hosts-official-support.95/
Login and register for what?

Check some other tubes and you have to work a lot on you website if you wan ANY traffic at all.

Review: Filechick.com | Proxies-free – Webmaster Forum

Site is https://filechick.com (imgbb.co, postimg.cc clone)

My friends site, he asked me for feedback so I decided to ask yall

His promises:
Never display any popups
Never any ads on homepage
2GB Max File Size
Totally free!

No restrictions, all files are welcome.

You can also use service for backup, pls report any issues below and I forward to him

Javascript Pub/Sub – Code Review Stack Exchange

Here is a short pice of code that suppose to work as Pub/Sub or EventDisptacher of some sort.

I only do code in JS a few times a year, so hence I’m asking for your time. Right now I’m working on little full-stack pice for my portfolio, and I’m really not a frontend developer 🙂

Here is the code:

class StreamDispatcher {
  constructor() {
    this._listeners = new Map();
  }

  register(obj, identifier, event, fn) {
    const objectTarget = this._digMap(this._listeners, (identifier, event), Map);
    const funcs = this._digMap(objectTarget, obj, Set);
    
    funcs.add(fn);
  }

  unregister(obj, identifier, event, fn) {
    const funcs = this._digMap(this._listeners, (identifier, event, obj));
    funcs?.delete(fn);
  }

  unregisterAll(obj, identifier, event) {
    const objectTarget = this._digMap(this._listeners, (identifier, event));
    objectTarget?.delete(obj);
  }

  dispatch(identifier, event) {
    const objectTarget = this._digMap(this._listeners, (identifier, event));

    objectTarget?.forEach((funcs, obj) => {
      funcs.forEach(fn => fn.call(obj));
    });
  }

  _digMap(map, keys, initalizer) {
    keys = (...(keys)).flat();
    const key = keys.shift();

    let value = map.get(key);

    if(!value && initalizer) {
      value = new(initalizer);
      map.set(key, value);
    }

    if(!keys.length || !value) 
      return value;

    return this._digMap(value, keys, initalizer);
  }
}

Sample usage scenario:

const sd = new StreamDispatcher();

class App {
  constructor()
  {
    this.name = "name";
    sd.register(this, "List:1234", "print", this.printName);
  }

  printName() {
    console.log(this.name);
  }

  ondisable() {
    sd.unregisterAll(this, "List:1234", "print");
  }
}

const app1 = new App();

sd.dispatch("List:1234", "print"); //Output: name
app1.name = "Test";
sd.dispatch("List:1234", "print"); //Output: Test

app1.ondisable();
sd.dispatch("List:1234", "print"); //No output

c – Arduino algorithm – Code Review Stack Exchange

I have 3 push buttons, 3 leds, and 2 relays. When you push button1 once, the led1 turns on and timer is set to 10 sec. When push button1 twice, led2 turns on and timer is set to 20 sec. When push second button once, select first relay. When pushs second button twice, then select second relay. And in the end start button (button3) to start saved relays and led3 for time that we before set.

code:

#define BTN1_PIN 3
#define BTN2_PIN 4
#include <GyverButton.h>
GButton butt1(BTN1_PIN);
GButton butt2(BTN2_PIN);
int relay1=8;
int relay2=9;
int led=5;
int led2=6;
int led3=7;

int butt3=5;

int secmek=0;
int gozlemek=0;

void setup() {
  Serial.begin(9600);
  butt1.setDebounce(150);
  butt2.setDebounce(150);
  butt1.setClickTimeout(500);
  butt2.setClickTimeout(500);
  pinMode(relay1, OUTPUT);
  digitalWrite(relay1, LOW); 
  pinMode(relay2,OUTPUT);
  digitalWrite(relay2, LOW); 
  pinMode(led,OUTPUT);
  pinMode(led2,OUTPUT);
  pinMode(led3,OUTPUT);
}

void loop() {
  digitalWrite(led,LOW);
  digitalWrite(led2,LOW);
  digitalWrite(led3,LOW);
  digitalWrite(relay1,LOW);
  digitalWrite(relay2,LOW);
  butt1.tick();
  butt2.tick();

if(butt1.hasClicks()){
  byte clicks = butt1.getClicks();
  switch(clicks){
    case 1: 
      digitalWrite(led, HIGH);
      gozlemek=10000;
      break;
    case 2: 
      digitalWrite(led2,HIGH);
      digitalWrite(led,LOW);
      gozlemek=20000;
      break;
    }
 }


if(butt2.hasClicks()){
  byte clicks = butt2.getClicks();
  switch(clicks){
    case 1: 
      secmek=1;
      break;
    case 2: 
      secmek=2;
      break;
    case 3:
      secmek=3;
      break;
    }
  }

if(butt3 = HIGH){
  digitalWrite(led3,HIGH);
    switch(secmek){
      case 1:
        digitalWrite(relay1, HIGH);
        break;
      case 2:
        digitalWrite(relay2,HIGH);
        digitalWrite(relay1,LOW);
        break;
      case 3:
        digitalWrite(relay1, HIGH);
        digitalWrite(relay2, HIGH);
        break;
    }
    delay(gozlemek);
 }

}