Skip to content

Commit

Permalink
- fixed a bug in systemimpl.c that caused an endless loop in System.s…
Browse files Browse the repository at this point in the history
…tringReplace

- fixed the OMShell code to compile on Unix (added OMShell.pro)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2379 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed May 15, 2006
1 parent e886df8 commit 7d57dc9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -400,6 +400,14 @@ RML_BEGIN_LABEL(System__stringReplace)
char *target = RML_STRINGDATA(rmlA2);
char * res=0;

/* adrpo 2006-05-15
* if source and target are the same this function
* cycles, get rid of that here
*/
if (!strcmp(source, target))
RML_TAILCALLK(rmlSC);
/* end adrpo */

res = _replace(str,source,target);

if (res == NULL) {
Expand Down
12 changes: 11 additions & 1 deletion Compiler/winruntime/systemimpl.c
Expand Up @@ -389,8 +389,18 @@ RML_BEGIN_LABEL(System__stringReplace)
char *target =/* strdup( */RML_STRINGDATA(rmlA2)/* ) */;
char * res=0;
/* printf("in '%s' replace '%s' with '%s'\n",str,source,target); */

/* adrpo 2006-05-15
* if source and target are the same this function
* cycles, get rid of that here
*/
if (!strcmp(source, target))
RML_TAILCALLK(rmlSC);
/* end adrpo */

res = _replace(str,source,target);
if (res == NULL) {
if (res == NULL)
{
/* printf("res == NULL\n"); */
RML_TAILCALLK(rmlFC);
}
Expand Down

0 comments on commit 7d57dc9

Please sign in to comment.