Commit 8484c928 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(fparse_conference_2): Use l2g_read instead of fparse_text_list.

(fparse_person_2): Likewise.
(fparse_text_list): The result argument now points to a
	Local_to_global instead of a Text_list.
parent adb7a81a
/*
* $Id: ram-parse.c,v 0.28 1998/07/08 16:58:30 ceder Exp $
* $Id: ram-parse.c,v 0.29 1998/07/26 16:43:11 ceder Exp $
* Copyright (C) 1991, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -30,7 +30,7 @@
*/
static const char *
rcsid = "$Id: ram-parse.c,v 0.28 1998/07/08 16:58:30 ceder Exp $";
rcsid = "$Id: ram-parse.c,v 0.29 1998/07/26 16:43:11 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -53,9 +53,12 @@ USE(rcsid);
#include "server/smalloc.h"
#include "kom-errno.h"
#include "kom-memory.h"
#include "local-to-global.h"
static int input_format = 2;
static Success fparse_text_list(FILE *fp, Local_to_global *result);
void
set_input_format(int fmt)
{
......@@ -198,7 +201,7 @@ fparse_conference_2(FILE *fp,
}
if ( fparse_member_list(fp, &result->members) != OK
|| fparse_text_list(fp, &result->texts) != OK
|| l2g_read(fp, &result->texts) != OK
|| fparse_conf_type(fp, &result->type) != OK )
{
log("fparse_conference: file is corrupt.\n");
......@@ -468,7 +471,7 @@ fparse_person_2(FILE *fp,
if ( fparse_string(fp, &person->username) != OK
|| fparse_priv_bits(fp, &person->privileges) != OK
|| fparse_personal_flags(fp, &person->flags) != OK
|| fparse_text_list(fp, &person->created_texts) != OK
|| l2g_read(fp, &person->created_texts) != OK
|| fparse_mark_list(fp, &person->marks) != OK
|| fparse_membership_list(fp, &person->conferences) != OK )
{
......@@ -1466,34 +1469,26 @@ fparse_text_stat(FILE *fp,
}
extern Success
static Success
fparse_text_list(FILE *fp,
Text_list *result)
Local_to_global *result)
{
unsigned long i;
Local_text_no lno;
Local_text_no no_of_texts;
result->first_local_no = fparse_long(fp);
result->no_of_texts = fparse_long(fp);
lno = fparse_long(fp);
no_of_texts = fparse_long(fp);
l2g_clear(result);
if ( result->no_of_texts > 0 )
if (no_of_texts > 0)
{
fskipwhite(fp);
switch(getc(fp))
{
case '{':
result->texts = REALLOC(result->texts,
(result->no_of_texts
* sizeof(Text_no)));
if ( result->texts == NULL )
{
err_stat = 0;
kom_errno = KOM_OUT_OF_MEMORY;
return FAILURE;
}
for ( i = 0; i < result->no_of_texts; i++)
result->texts[ i ] = fparse_long(fp);
for ( i = 0; i < no_of_texts; i++)
l2g_append(result, lno++, fparse_long(fp));
fskipwhite(fp);
if ( getc(fp) != '}' )
......@@ -1507,16 +1502,8 @@ fparse_text_list(FILE *fp,
break;
case '*':
if ( result->texts != NULL )
{
sfree(result->texts);
result->texts = NULL;
}
break;
default:
log("fparse_text_list(): expected '*' or '{' at pos %lu.\n",
log("fparse_text_list(): expected '{' at pos %lu.\n",
(unsigned long)ftell(fp));
err_stat = 23;
kom_errno = KOM_LDB_ERR;
......@@ -1534,11 +1521,6 @@ fparse_text_list(FILE *fp,
kom_errno = KOM_LDB_ERR;
return FAILURE;
}
if ( result->texts != NULL )
{
sfree(result->texts);
result->texts = NULL;
}
}
return OK;
}
......
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