Bumping gaia.json for 1 gaia revision(s) a=gaia-bump
[gecko.git] / intl / hyphenation / hnjalloc.h
bloba5e7693227e31659a1fbc3cbde968c742c1ac2b3
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /*
7 * Simple replacement for hnjalloc.h from libhyphen-2.x, to use moz_x* memory
8 * allocation functions. Note that the hyphen.c code does *NOT* check for
9 * NULL from memory (re)allocation, so it is essential that we use the
10 * "infallible" moz_x* variants here.
13 #include "mozilla/mozalloc.h"
15 #define hnj_malloc(size) moz_xmalloc(size)
16 #define hnj_realloc(p, size) moz_xrealloc(p, size)
17 #define hnj_free(p) moz_free(p)
20 * To enable us to load hyphenation dictionaries from arbitrary resource URIs,
21 * not just through file paths using stdio, we override the (few) stdio APIs
22 * that hyphen.c uses and provide our own reimplementation that calls Gecko
23 * i/o methods.
26 #include <stdio.h> /* ensure stdio.h is loaded before our macros */
28 #undef FILE
29 #define FILE hnjFile
31 #define fopen(path,mode) hnjFopen(path,mode)
32 #define fclose(file) hnjFclose(file)
33 #define fgets(buf,count,file) hnjFgets(buf,count,file)
35 typedef struct hnjFile_ hnjFile;
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 hnjFile* hnjFopen(const char* aURISpec, const char* aMode);
43 int hnjFclose(hnjFile* f);
45 char* hnjFgets(char* s, int n, hnjFile* f);
47 #ifdef __cplusplus
49 #endif