Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sven Gestegård Robertz
LabComm
Commits
d4a29d93
Commit
d4a29d93
authored
Apr 28, 2014
by
Tommy Olofsson
Browse files
Print better error messages on fatal error.
parent
7ee6a039
Changes
2
Show whitespace changes
Inline
Side-by-side
lib/c/labcomm.c
View file @
d4a29d93
...
@@ -246,7 +246,7 @@ void labcomm_set_local_index(struct labcomm_signature *signature)
...
@@ -246,7 +246,7 @@ void labcomm_set_local_index(struct labcomm_signature *signature)
{
{
if
(
signature
->
index
!=
0
)
{
if
(
signature
->
index
!=
0
)
{
labcomm_error_fatal_global
(
LABCOMM_ERROR_SIGNATURE_ALREADY_SET
,
labcomm_error_fatal_global
(
LABCOMM_ERROR_SIGNATURE_ALREADY_SET
,
"
%s
"
,
signature
->
name
);
"
Signature already set: %s
\n
"
,
signature
->
name
);
}
}
signature
->
index
=
local_index
;
signature
->
index
=
local_index
;
local_index
++
;
local_index
++
;
...
@@ -256,7 +256,7 @@ int labcomm_get_local_index(struct labcomm_signature *signature)
...
@@ -256,7 +256,7 @@ int labcomm_get_local_index(struct labcomm_signature *signature)
{
{
if
(
signature
->
index
==
0
)
{
if
(
signature
->
index
==
0
)
{
labcomm_error_fatal_global
(
LABCOMM_ERROR_SIGNATURE_NOT_SET
,
labcomm_error_fatal_global
(
LABCOMM_ERROR_SIGNATURE_NOT_SET
,
"
%s
"
,
signature
->
name
);
"
Signature not set: %s
\n
"
,
signature
->
name
);
}
}
return
signature
->
index
;
return
signature
->
index
;
}
}
lib/c/labcomm_error.c
View file @
d4a29d93
...
@@ -21,12 +21,19 @@
...
@@ -21,12 +21,19 @@
#include
<stdlib.h>
#include
<stdlib.h>
#include
<stdio.h>
#include
<stdio.h>
#include
<stdarg.h>
#include
"labcomm_error.h"
#include
"labcomm_error.h"
void
labcomm_error_fatal_global
(
enum
labcomm_error
error
,
void
labcomm_error_fatal_global
(
enum
labcomm_error
error
,
char
*
format
,
char
*
format
,
...)
...)
{
{
va_list
args
;
fprintf
(
stderr
,
"Fatal error %d
\n
"
,
error
);
fprintf
(
stderr
,
"Fatal error %d
\n
"
,
error
);
va_start
(
args
,
format
);
vprintf
(
format
,
args
);
va_end
(
args
);
exit
(
1
);
exit
(
1
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment