blob: f90814e0657fdc86106918d22eba6d77019ba5e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*--------------------------------------------------------------------------*/
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA - Cong WU
*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at
* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
*
*/
/*--------------------------------------------------------------------------*/
#include <string.h>
#include <stdio.h>
#include "gw_string.h"
#include "stack-c.h"
#include "MALLOC.h"
#include "Scierror.h"
#include "CreateEmptystr.h"
#include "localization.h"
#include "freeArrayOfString.h"
/*--------------------------------------------------------------------------*/
char ** CreateEmptystr(int m1, int n1)
{
int m1n1 = m1 * n1;
char **OutputStrings = (char**)MALLOC(sizeof(char*) * (m1n1 + 1));
if (OutputStrings)
{
int i = 0;
for (i = 0; i < m1n1; i++) /*m1 is the number of row ; n1 is the number of col*/
{
OutputStrings[i] = (char*)MALLOC(sizeof(char) * (strlen(EMPTY_STRING) + 1));
if (OutputStrings[i])
{
strcpy(OutputStrings[i], EMPTY_STRING);
}
else
{
freeArrayOfString(OutputStrings, m1n1);
return NULL;
}
}
}
return OutputStrings;
}
/*--------------------------------------------------------------------------*/
|