summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nouveau_stateobj.h
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2008-02-18 18:23:12 +1100
committerBen Skeggs <[email protected]>2008-02-18 18:23:12 +1100
commitc0f9cab905f3f54cc01bf947665f8a731b8cb347 (patch)
tree92b71dba7535052dc4988e0bc0e21b83f16245ee /src/gallium/drivers/nouveau/nouveau_stateobj.h
parent9a5dd26fe22c37b85787130a2b724e6e8ef4f553 (diff)
nouveau: cleanups + fixes
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_stateobj.h')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_stateobj.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h
index 07c31b014a5..459cc7d77ae 100644
--- a/src/gallium/drivers/nouveau/nouveau_stateobj.h
+++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h
@@ -45,22 +45,19 @@ so_new(unsigned push, unsigned reloc)
static INLINE void
so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso)
{
- struct nouveau_stateobj *so;
-
- so = *pso;
- if (so) {
- if (--so->refcount <= 0) {
- free(so->push);
- free(so->reloc);
- free(so);
- }
- *pso = NULL;
- }
+ struct nouveau_stateobj *so = *pso;
if (ref) {
ref->refcount++;
- *pso = ref;
}
+
+ if (so && --so->refcount <= 0) {
+ free(so->push);
+ free(so->reloc);
+ free(so);
+ }
+
+ *pso = ref;
}
static INLINE void