projects
/
pspp-builds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a5ce189
)
intern: Use UP_CAST macro instad of open-coding it.
author
Ben Pfaff
<blp@cs.stanford.edu>
Wed, 13 Apr 2011 03:42:47 +0000
(20:42 -0700)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Wed, 13 Apr 2011 03:42:47 +0000
(20:42 -0700)
src/libpspp/intern.c
patch
|
blob
|
history
diff --git
a/src/libpspp/intern.c
b/src/libpspp/intern.c
index 0bb9277dc9172ae3aad1b801df4fba36cc606dac..258e2829af132f8548b59a00577a29c623fcbabc 100644
(file)
--- a/
src/libpspp/intern.c
+++ b/
src/libpspp/intern.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010
, 2011
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-22,6
+22,7
@@
#include <string.h>
#include "libpspp/assertion.h"
#include <string.h>
#include "libpspp/assertion.h"
+#include "libpspp/cast.h"
#include "libpspp/hash-functions.h"
#include "libpspp/hmap.h"
#include "libpspp/hash-functions.h"
#include "libpspp/hmap.h"
@@
-76,8
+77,7
@@
intern_new (const char *s)
static struct interned_string *
interned_string_from_string (const char *s)
{
static struct interned_string *
interned_string_from_string (const char *s)
{
- const size_t ofs = offsetof (struct interned_string, string);
- struct interned_string *is = (struct interned_string *) (s - ofs);
+ struct interned_string *is = UP_CAST (s, struct interned_string, string);
assert (is->ref_cnt > 0);
return is;
}
assert (is->ref_cnt > 0);
return is;
}