~ubuntu-branches/ubuntu/precise/ncurses/precise

« back to all changes in this revision

Viewing changes to test/cardfile.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2008-11-11 16:40:32 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20081111164032-dudxd0hy2im0f2bj
Tags: 5.7-2ubuntu1
* Merge from debian unstable, remaining changes:
  - On amd64, use /{,usr/}lib32 instead of /emul/ia32-linux/.
  - Link using -Bsymbolic-functions.
  - Don't install the upstream changelog in the runtime library packages.

* Install wide-character patches into /{,usr/}lib32 as well.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/****************************************************************************
2
 
 * Copyright (c) 1999-2006,2007 Free Software Foundation, Inc.              *
 
2
 * Copyright (c) 1999-2007,2008 Free Software Foundation, Inc.              *
3
3
 *                                                                          *
4
4
 * Permission is hereby granted, free of charge, to any person obtaining a  *
5
5
 * copy of this software and associated documentation files (the            *
29
29
/*
30
30
 * Author: Thomas E. Dickey
31
31
 *
32
 
 * $Id: cardfile.c,v 1.32 2007/08/11 16:34:27 tom Exp $
 
32
 * $Id: cardfile.c,v 1.35 2008/08/05 00:42:24 tom Exp $
33
33
 *
34
34
 * File format: text beginning in column 1 is a title; other text is content.
35
35
 */
73
73
static char *
74
74
strdup(const char *s)
75
75
{
76
 
    char *p = (char *) malloc(strlen(s) + 1);
 
76
    char *p = typeMalloc(char, strlen(s) + 1);
77
77
    if (p)
78
78
        strcpy(p, s);
79
79
    return (p);
111
111
            break;
112
112
    }
113
113
 
114
 
    card = (CARD *) calloc(1, sizeof(CARD));
 
114
    card = typeCalloc(CARD, 1);
115
115
    card->title = strdup(title);
116
116
    card->content = strdup("");
117
117
 
133
133
 
134
134
    content = skip(content);
135
135
    if ((total = strlen(content)) != 0) {
136
 
        if ((offset = strlen(card->content)) != 0) {
 
136
        if (card->content != 0 && (offset = strlen(card->content)) != 0) {
137
137
            total += 1 + offset;
138
 
            card->content = (char *) realloc(card->content, total + 1);
 
138
            card->content = typeRealloc(char, total + 1, card->content);
139
139
            if (card->content)
140
140
                strcpy(card->content + offset++, " ");
141
141
        } else {
 
142
            offset = 0;
142
143
            if (card->content != 0)
143
144
                free(card->content);
144
 
            card->content = (char *) malloc(total + 1);
 
145
            card->content = typeMalloc(char, total + 1);
145
146
        }
146
147
        if (card->content)
147
148
            strcpy(card->content + offset, content);
336
337
static FIELD **
337
338
make_fields(CARD * p, int form_high, int form_wide)
338
339
{
339
 
    FIELD **f = (FIELD **) calloc(3, sizeof(FIELD *));
 
340
    FIELD **f = typeCalloc(FIELD *, 3);
340
341
 
341
342
    f[0] = new_field(1, form_wide, 0, 0, 0, 0);
342
343
    set_field_back(f[0], A_REVERSE);