rizin/libr/parse/p/parse_mreplace.c
pancake 65da25d4c0 * Implement STATIC PLUGIN support for r_parse
- Use the new 'asm-like' build system for r_parse plugins
  - Added new callback to 'assemble' parseable expressions
    into compilable asm code
  - Refactorize and remove warnings in parse_mreplace
* Added r_str_char_count() in r_util
* Some fixups in the fastcall code in r_asm

--HG--
rename : libr/parse/p/mreplace/mmemory.c => libr/parse/p/parse_mreplace/mmemory.c
rename : libr/parse/p/mreplace/mmemory.h => libr/parse/p/parse_mreplace/mmemory.h
rename : libr/parse/p/mreplace/mreplace.c => libr/parse/p/parse_mreplace/mreplace.c
rename : libr/parse/p/mreplace/mreplace.h => libr/parse/p/parse_mreplace/mreplace.h
2009-08-14 01:44:12 +00:00

44 lines
826 B
C

/* radare - LGPL - Copyright 2009 nibble<.ds@gmail.com> */
#include <stdio.h>
#include <stdlib.h>
#include "parse_mreplace/mreplace.h"
#include <r_lib.h>
#include <r_parse.h>
struct mreplace_t {
char *data;
char *search;
char *replace;
};
static int parse(struct r_parse_t *p, void *data, char *str)
{
struct mreplace_t *sdata = (struct mreplace_t*)data;
char *buf = NULL;
buf = treplace(sdata->data, sdata->search, sdata->replace);
memcpy(str, buf, R_PARSE_STRLEN);
if (buf != NULL)
free(buf);
return R_TRUE;
}
struct r_parse_handle_t r_parse_plugin_mreplace = {
.name = "parse_mreplace",
.desc = "mreplace parsing plugin",
.init = NULL,
.fini = NULL,
.parse = &parse,
};
#ifndef CORELIB
struct r_lib_struct_t radare_plugin = {
.type = R_LIB_TYPE_PARSE,
.data = &r_parse_plugin_mreplace
};
#endif