summaryrefslogtreecommitdiff
path: root/backend/dvi/mdvi-lib/util.c
diff options
context:
space:
mode:
authorLaurent Napias <[email protected]>2019-06-29 10:43:23 +0200
committerraveit65 <[email protected]>2019-07-01 17:07:40 +0200
commitaa24676651f8bd3e8b434f72d5aac98e84c0867d (patch)
tree37693766ecb4733c6061dcc2ddc26954fab5ca01 /backend/dvi/mdvi-lib/util.c
parent6741c5db1e5c48c01b25bb7900dc40d48552925d (diff)
downloadatril-aa24676651f8bd3e8b434f72d5aac98e84c0867d.tar.bz2
atril-aa24676651f8bd3e8b434f72d5aac98e84c0867d.tar.xz
Remove trailing whitespaces
Diffstat (limited to 'backend/dvi/mdvi-lib/util.c')
-rw-r--r--backend/dvi/mdvi-lib/util.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/backend/dvi/mdvi-lib/util.c b/backend/dvi/mdvi-lib/util.c
index 349d273a..15b53f13 100644
--- a/backend/dvi/mdvi-lib/util.c
+++ b/backend/dvi/mdvi-lib/util.c
@@ -85,7 +85,7 @@ int mdvi_set_logstream(FILE *file)
int mdvi_set_loglevel(int level)
{
int old = _mdvi_log_level;
-
+
_mdvi_log_level = level;
return old;
}
@@ -96,7 +96,7 @@ Uint32 _mdvi_debug_mask = 0;
void __debug(int mask, const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
if(_mdvi_debug_mask & mask) {
if(!DEBUGGING(SILENT)) {
@@ -118,7 +118,7 @@ void __debug(int mask, const char *format, ...)
void mdvi_message(const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
if(_mdvi_log_level >= LOG_INFO) {
fprintf(stderr, "%s: ", program_name);
@@ -135,10 +135,10 @@ void mdvi_message(const char *format, ...)
void mdvi_crash(const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
- fprintf(stderr, "%s: %s: ",
- program_name,
+ fprintf(stderr, "%s: %s: ",
+ program_name,
gettext(messages[(int)time(NULL) % NMSGS]));
vfprintf(stderr, format, ap);
#ifndef __GNUC__
@@ -154,7 +154,7 @@ void mdvi_crash(const char *format, ...)
void mdvi_error(const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
fprintf(stderr, _("%s: Error: "), program_name);
vfprintf(stderr, format, ap);
@@ -170,7 +170,7 @@ void mdvi_error(const char *format, ...)
void mdvi_warning(const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
fprintf(stderr, _("%s: Warning: "), program_name);
vfprintf(stderr, format, ap);
@@ -186,7 +186,7 @@ void mdvi_warning(const char *format, ...)
void mdvi_fatal(const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
fprintf(stderr, _("%s: Fatal: "), program_name);
vfprintf(stderr, format, ap);
@@ -207,7 +207,7 @@ void mdvi_fatal(const char *format, ...)
void *mdvi_malloc(size_t nelems)
{
void *ptr = malloc(nelems);
-
+
if(ptr == NULL)
mdvi_fatal(_("out of memory allocating %u bytes\n"),
(unsigned)nelems);
@@ -217,19 +217,19 @@ void *mdvi_malloc(size_t nelems)
void *mdvi_realloc(void *data, size_t newsize)
{
void *ptr;
-
+
if(newsize == 0)
mdvi_crash(_("attempted to reallocate with zero size\n"));
ptr = realloc(data, newsize);
if(ptr == NULL)
mdvi_fatal(_("failed to reallocate %u bytes\n"), (unsigned)newsize);
- return ptr;
+ return ptr;
}
void *mdvi_calloc(size_t nmemb, size_t size)
{
void *ptr;
-
+
if(nmemb == 0)
mdvi_crash(_("attempted to callocate 0 members\n"));
if(size == 0)
@@ -253,7 +253,7 @@ char *mdvi_strdup(const char *string)
{
int length;
char *ptr;
-
+
length = strlen(string) + 1;
ptr = (char *)mdvi_malloc(length);
memcpy(ptr, string, length);
@@ -272,7 +272,7 @@ char *mdvi_strndup(const char *string, size_t length)
{
int n;
char *ptr;
-
+
n = strlen(string);
if(n > length)
n = length;
@@ -284,7 +284,7 @@ char *mdvi_strndup(const char *string, size_t length)
void *mdvi_memdup(const void *data, size_t length)
{
void *ptr = mdvi_malloc(length);
-
+
memcpy(ptr, data, length);
return ptr;
}
@@ -339,7 +339,7 @@ char *mdvi_build_path_from_cwd (const char *path)
buf = mdvi_realloc (buf, strlen (buf) + strlen (path) + 2);
strcat (buf, "/");
strncat (buf, path, strlen (path));
-
+
return buf;
}
@@ -349,9 +349,9 @@ double unit2pix_factor(const char *spec)
double factor;
const char *p, *q;
static const char *units = "incmmmmtptpcddccspbpftydcs";
-
+
val = 0.0;
-
+
for(p = spec; *p >= '0' && *p <= '9'; p++)
val = 10.0 * val + (double)(*p - '0');
if(*p == '.') {
@@ -389,14 +389,14 @@ double unit2pix_factor(const char *spec)
int unit2pix(int dpi, const char *spec)
{
double factor = unit2pix_factor(spec);
-
+
return (int)(factor * dpi + 0.5);
}
Ulong get_mtime(int fd)
{
struct stat st;
-
+
if(fstat(fd, &st) == 0)
return (Ulong)st.st_mtime;
return 0;
@@ -419,7 +419,7 @@ char *getword(char *string, const char *delim, char **end)
{
char *ptr;
char *word;
-
+
/* skip leading delimiters */
for(ptr = string; *ptr && strchr(delim, *ptr); ptr++);
@@ -438,10 +438,10 @@ char *getstring(char *string, const char *delim, char **end)
char *ptr;
char *word;
int quoted = 0;
-
+
/* skip leading delimiters */
for(ptr = string; *ptr && strchr(delim, *ptr); ptr++);
-
+
if(ptr == NULL)
return NULL;
quoted = (*ptr == '"');
@@ -456,7 +456,7 @@ char *getstring(char *string, const char *delim, char **end)
static long pow2(size_t n)
{
long x = 8; /* don't bother allocating less than this */
-
+
while(x < n)
x <<= 1L;
return x;
@@ -487,7 +487,7 @@ int dstring_append(Dstring *dstr, const char *string, int len)
dstr->data = mdvi_malloc(8);
dstr->data[0] = 0;
}
-
+
return dstr->length;
}