summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/debugcmd.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-01-08 17:18:54 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-01-08 17:18:54 +0000
commita92de5930cef847ffdafd1e6c8e9f2bf03375c39 (patch)
treee8e5887dfcf861cc77ed1675015267450fc6fc8a /src/emu/debug/debugcmd.c
parenta0a40f8815e5c16bd2ab8ee333d19bcfe1e6ee55 (diff)
Extended the astring class wrapper into something useful, and
useable as a stack object. Also designed the interfaces to allow for chaining operations. And added a casting operator to const char * for seamless use in most functions that take plain old C strings. Changed all uses of astring to use the object directly on the stack or embedded in objects instead of explicitly allocating and deallocating it. Removed a lot of annoying memory management code as a result. Changed interfaces that accepted/returned an astring * to use an astring & instead. Removed auto_alloc_astring(machine). Use auto_alloc(machine, astring) instead.
Diffstat (limited to 'src/emu/debug/debugcmd.c')
-rw-r--r--src/emu/debug/debugcmd.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c
index 56dd599d1f0..6db207d7fb7 100644
--- a/src/emu/debug/debugcmd.c
+++ b/src/emu/debug/debugcmd.c
@@ -2502,7 +2502,6 @@ static void execute_snap(running_machine *machine, int ref, int params, const ch
mame_file *fp;
const char *filename = param[0];
int scrnum = (params > 1) ? atoi(param[1]) : 0;
- astring *fname;
const device_config *screen = device_list_find_by_index(&machine->config->devicelist, VIDEO_SCREEN, scrnum);
@@ -2512,11 +2511,10 @@ static void execute_snap(running_machine *machine, int ref, int params, const ch
return;
}
- fname = astring_dupc(filename);
- if (astring_findc(fname, 0, ".png") == -1)
- astring_catc(fname, ".png");
- filerr = mame_fopen(SEARCHPATH_SCREENSHOT, astring_c(fname), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &fp);
- astring_free(fname);
+ astring fname(filename);
+ if (fname.find(0, ".png") == -1)
+ fname.cat(".png");
+ filerr = mame_fopen(SEARCHPATH_SCREENSHOT, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &fp);
if (filerr != FILERR_NONE)
{