Commit 34ac5968 authored by LAMBERT Jean-charles's avatar LAMBERT Jean-charles

rename get/put_string func to prevent crash on macosx with python

parent cb5b370c
......@@ -281,10 +281,10 @@ void put_tes(stream str, string tag)
}
/*
* PUT_STRING: write string to a structured file.
* __nemo_PUT_STRING: write string to a structured file.
*/
void put_string(stream str, string tag, string dat)
void __nemo_put_string(stream str, string tag, string dat)
{
put_data(str, tag, CharType, dat, xstrlen(dat, 1), 0);
}
......@@ -699,11 +699,11 @@ void get_data_blocked(
/*
* GET_STRING: read a string from a structured file.
* __nemo_GET_STRING: read a string from a structured file.
* returns pointer to freshly allocated space that can be free'd
*/
string get_string(
string __nemo_get_string(
stream str, /* stream to read string from */
string tag /* tag to compare with item */
) {
......@@ -716,16 +716,16 @@ string get_string(
sspt = findstream(str); /* access assoc. info */
ipt = scantag(sspt, tag); /* scan input for tag */
if (ipt == NULL) /* check input succeeded */
error("get_string: at EOF");
error("__nemo_get_string: at EOF");
dp = ItemDim(ipt); /* get list of dimensions */
if (! streq(ItemTyp(ipt), CharType) || /* check type of item */
dp == NULL || *dp++ == 0 || *dp != 0) /* and shape of data */
error("get_string: item %s: not plural char", tag);
error("__nemo_get_string: item %s: not plural char", tag);
dlen = datlen(ipt,0);
if(dlen<0) error("get_string: %s with dlen=%d",tag,dlen); /* yuck */
if(dlen<0) error("__nemo_get_string: %s with dlen=%d",tag,dlen); /* yuck */
dat = (char *) calloc(dlen,1); /* alloc memory for string */
if (dat == NULL) /* did alloc fail? */
error("get_string: item %s: not enuf memory", tag);
error("__nemo_get_string: item %s: not enuf memory", tag);
copydata(dat, 0, dlen, ipt, str); /* copy string from input */
if (sspt->ss_stp == -1) /* item read at top level? */
freeitem(ipt, TRUE); /* yes, so free it up */
......
......@@ -70,7 +70,7 @@ int get_history(stream instr)
{
for(;;) { /* loop reading input data */
if (get_tag_ok(instr, HeadlineTag)) {
headline = get_string(instr, HeadlineTag);
headline = __nemo_get_string(instr, HeadlineTag);
dprintf(5, "get_history: headline = %s\n", headline);
} else if (get_tag_ok(instr, HistoryTag)) {
if (nhist > MAXHIST) {
......@@ -78,7 +78,7 @@ int get_history(stream instr)
MAXHIST);
return MAXHIST;
}
histbuf[nhist] = get_string(instr, HistoryTag);
histbuf[nhist] = __nemo_get_string(instr, HistoryTag);
dprintf(5, "get_history: histbuf[%d] = %s\n",
nhist, histbuf[nhist]);
freeup[nhist] = FALSE;
......@@ -104,12 +104,12 @@ int put_history(stream outstr)
}
if (headline != NULL) {
dprintf(5, "put_history: headline = %s\n", headline);
put_string(outstr, HeadlineTag, headline);
__nemo_put_string(outstr, HeadlineTag, headline);
}
dprintf(5, "put_history: writing %d history items\n", nhist);
for (i = 0; i < nhist; i++) {
dprintf(5, " histbuf[%d] = %s\n", i, histbuf[i]);
put_string(outstr, HistoryTag, histbuf[i]);
__nemo_put_string(outstr, HistoryTag, histbuf[i]);
}
/* nhist = 0; // reset counter -- why? JEB */
return 0;
......
......@@ -302,7 +302,7 @@ int get_data_select(char * infile,
get_history(instr[no_io]);
while (get_tag_ok(instr[no_io],HeadlineTag))
headline = get_string(instr[no_io],HeadlineTag);
headline = __nemo_get_string(instr[no_io],HeadlineTag);
if (!get_tag_ok(instr[no_io], SnapShotTag)) {
if (!read_one[no_io]) {
......
......@@ -329,7 +329,7 @@ int get_data_select_f(char * infile,
get_history(instr[no_io]);
while (get_tag_ok(instr[no_io],HeadlineTag))
headline = get_string(instr[no_io],HeadlineTag);
headline = __nemo_get_string(instr[no_io],HeadlineTag);
if (!get_tag_ok(instr[no_io], SnapShotTag)) {
if (!read_one[no_io]) { /* file has never been read */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment