SalamLang / Salam

Salam Language: The inaugural coding language for Persian and Arabic speakers, inspired by the word "salam" meaning "peace". With a user-friendly approach, it provides an accessible coding experience, promoting collaboration and simplicity for local developers and students.
https://www.salamlang.ir
GNU General Public License v3.0
1 stars 5 forks source link

Abstract Malloc through macro #127

Closed janus closed 5 days ago

janus commented 2 weeks ago

Abstract malloc through macro

erfangnu commented 6 days ago
<<<<<<< AbstractMalloc
    ast_literal_t* res;
    CREATE_MEMORY_OBJECT(res, ast_literal_t, 1, "Error: interpreter_expression_binary<res> - Memory allocation error in %s:%d\n",  __FILE__, __LINE__);
    res->main = (struct ast_expression_t**) &expr;
=======
    ast_literal_t* res = (ast_literal_t*) malloc(sizeof(ast_literal_t));
    res->main = &expr;
>>>>>>> main

please fix @janus

janus commented 6 days ago
<<<<<<< AbstractMalloc
  ast_literal_t* res;
  CREATE_MEMORY_OBJECT(res, ast_literal_t, 1, "Error: interpreter_expression_binary<res> - Memory allocation error in %s:%d\n",  __FILE__, __LINE__);
  res->main = (struct ast_expression_t**) &expr;
=======
  ast_literal_t* res = (ast_literal_t*) malloc(sizeof(ast_literal_t));
  res->main = &expr;
>>>>>>> main

please fix @janus

Fixed.

erfangnu commented 5 days ago

Thanks, I need your help to improve the project faster.

let's make it awesome. @janus

erfangnu commented 5 days ago

MERGED, THANKS. LGTM