[svn:parrot] r49037 - trunk/src/pmc
tcurtis at svn.parrot.org
tcurtis at svn.parrot.org
Thu Sep 16 08:22:52 UTC 2010
Author: tcurtis
Date: Thu Sep 16 08:22:52 2010
New Revision: 49037
URL: https://trac.parrot.org/parrot/changeset/49037
Log:
Use Parrot_str_to_cstring instead of strstart when passing prompt to functions
that expect C strings in FileHandle.readline_interactive.
Modified:
trunk/src/pmc/filehandle.pmc
Modified: trunk/src/pmc/filehandle.pmc
==============================================================================
--- trunk/src/pmc/filehandle.pmc Thu Sep 16 08:18:24 2010 (r49036)
+++ trunk/src/pmc/filehandle.pmc Thu Sep 16 08:22:52 2010 (r49037)
@@ -373,7 +373,10 @@
#ifdef PARROT_HAS_READLINE
/* 4-column indent to get c_indent.t to DTRT */
- char * const r = readline(got_prompt ? prompt->strstart : NULL);
+ char *prompt_cstring =
+ (got_prompt ? Parrot_str_to_cstring(INTERP, prompt) : NULL);
+ char * const r = readline(prompt_cstring);
+ Parrot_str_free_cstring(prompt_cstring);
if (r) {
if (*r)
@@ -383,8 +386,11 @@
free(r);
}
#else
- if (got_prompt)
- fprintf(stderr, "%s", prompt->strstart);
+ if (got_prompt) {
+ char *prompt_cstring = Parrot_str_to_cstring(INTERP, prompt);
+ fprintf(stderr, "%s", prompt_cstring);
+ Parrot_str_free_cstring(prompt_cstring);
+ }
if (!(PARROT_FILEHANDLE(SELF)->flags & PIO_F_LINEBUF))
Parrot_io_setlinebuf(INTERP, SELF);
More information about the parrot-commits
mailing list