orangeduck / BuildYourOwnLisp

Learn C and build your own programming language in under 1000 lines of code!
http://www.buildyourownlisp.com/
Other
2.84k stars 392 forks source link

mpc.c contains diff info #127

Closed gou4shi1 closed 6 years ago

gou4shi1 commented 6 years ago

For example:

static void mpc_input_mark(mpc_input_t *i) {

  if (i->backtrack < 1) { return; }

  i->marks_num++;
<<<<<<< HEAD

  if (i->marks_num > i->marks_slots) {
    i->marks_slots = i->marks_num + i->marks_num / 2;
    i->marks = realloc(i->marks, sizeof(mpc_state_t) * i->marks_slots);
    i->lasts = realloc(i->lasts, sizeof(char) * i->marks_slots);
  }

=======
  i->marks = realloc(i->marks, sizeof(mpc_state_t) * i->marks_num);
  i->lasts = realloc(i->lasts, sizeof(char) * i->marks_num);
>>>>>>> 9f9925ba69dda75ffc204da4c7809d793510885f
  i->marks[i->marks_num-1] = i->state;
  i->lasts[i->marks_num-1] = i->last;

  if (i->type == MPC_INPUT_PIPE && i->marks_num == 1) {
    i->buffer = calloc(1, 1);
  }

}
orangeduck commented 6 years ago

Thanks for the report. This should be fixed in the latest commits. Could you verify?

gou4shi1 commented 6 years ago

verified. thx!