~ubuntu-branches/ubuntu/natty/freecell-solver/natty

« back to all changes in this revision

Viewing changes to app_str.c

  • Committer: Bazaar Package Importer
  • Author(s): RISKO Gergely
  • Date: 2009-03-15 23:42:21 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090315234221-sx95hxyfyfgi0pja
Tags: 2.16.0-1
* Imported Upstream version 2.16.0 (closes: #518440)
* cmake is the new buildsystem

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
#define GROW_BY 4000
7
7
 
8
 
struct freecell_solver_append_string_struct
 
8
struct fc_solve_append_string_struct
9
9
{
10
10
    char * buffer;
11
11
    char * end_of_buffer;
13
13
    int size_of_margin;
14
14
};
15
15
 
16
 
typedef struct freecell_solver_append_string_struct freecell_solver_append_string_t;
 
16
typedef struct fc_solve_append_string_struct fc_solve_append_string_t;
17
17
 
18
 
freecell_solver_append_string_t * freecell_solver_append_string_alloc(int size_margin)
 
18
fc_solve_append_string_t * fc_solve_append_string_alloc(int size_margin)
19
19
{
20
 
    freecell_solver_append_string_t * app_str;
 
20
    fc_solve_append_string_t * app_str;
21
21
 
22
22
    if (size_margin > GROW_BY)
23
23
    {
24
24
        return NULL;
25
25
    }
26
26
 
27
 
    app_str = malloc(sizeof(freecell_solver_append_string_t));
 
27
    app_str = malloc(sizeof(fc_solve_append_string_t));
28
28
    app_str->max_size = GROW_BY;
29
29
    app_str->end_of_buffer = app_str->buffer = malloc(app_str->max_size);
30
30
    app_str->size_of_margin = size_margin;
32
32
    return app_str;
33
33
}
34
34
 
35
 
int freecell_solver_append_string_sprintf(
36
 
    freecell_solver_append_string_t * app_str,
 
35
int fc_solve_append_string_sprintf(
 
36
    fc_solve_append_string_t * app_str,
37
37
    char * format,
38
38
    ...
39
39
    )
62
62
    return num_chars_written;
63
63
}
64
64
 
65
 
char * freecell_solver_append_string_finalize(
66
 
    freecell_solver_append_string_t * app_str
 
65
char * fc_solve_append_string_finalize(
 
66
    fc_solve_append_string_t * app_str
67
67
    )
68
68
{
69
69
    char * ret;