MCPcopy Create free account
hub / github.com/capstone-engine/capstone / str_replace

Function str_replace

cs.c:553–565  ·  view source on GitHub ↗

replace str1 in target with str2; target starts with str1 output is put into result (which is array of char with size CS_MNEMONIC_SIZE) return 0 on success, -1 on failure

Source from the content-addressed store, hash-verified

551// output is put into result (which is array of char with size CS_MNEMONIC_SIZE)
552// return 0 on success, -1 on failure
553static int str_replace(char *result, char *target, const char *str1, char *str2)
554{
555 // only perform replacement if the output fits into result
556 if (strlen(target) - strlen(str1) + strlen(str2) < CS_MNEMONIC_SIZE - 1) {
557 // copy str2 to begining of result
558 strcpy(result, str2);
559 // skip str1 - already replaced by str2
560 strcat(result, target + strlen(str1));
561
562 return 0;
563 } else
564 return -1;
565}
566
567// fill insn with mnemonic & operands info
568static void fill_insn(struct cs_struct *handle, cs_insn *insn, char *buffer, MCInst *mci,

Callers 1

fill_insnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…