Small atom fixes.
diff --git a/include/atom.h b/include/atom.h
deleted file mode 100644
index 6177dfd..0000000
--- a/include/atom.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Atom table definitions
- *
- * Copyright 1993 Alexandre Julliard
- */
-
-#ifndef __WINE_ATOM_H
-#define __WINE_ATOM_H
-
-#include "windows.h"
-
-extern BOOL32 ATOM_Init( WORD globalTableSel );
-
-typedef struct
-{
- HANDLE16 next;
- WORD refCount;
- BYTE length;
- BYTE str[1];
-} ATOMENTRY;
-
-typedef struct
-{
- WORD size;
- HANDLE16 entries[1];
-} ATOMTABLE;
-
-#endif /* __WINE_ATOM_H */
diff --git a/include/global.h b/include/global.h
index 3e643a0..6933b98 100644
--- a/include/global.h
+++ b/include/global.h
@@ -39,4 +39,7 @@
extern BOOL32 VIRTUAL_SetFaultHandler(LPVOID addr, HANDLERPROC proc, LPVOID arg);
extern BOOL32 VIRTUAL_HandleFault(LPVOID addr);
+/* memory/atom.c */
+extern BOOL32 ATOM_Init( WORD globalTableSel );
+
#endif /* __WINE_GLOBAL_H */
diff --git a/loader/main.c b/loader/main.c
index 68c0a78..a2af563 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -17,7 +17,6 @@
#include "menu.h"
#include "message.h"
#include "multimedia.h"
-#include "atom.h"
#include "dialog.h"
#include "drive.h"
#include "queue.h"
diff --git a/memory/atom.c b/memory/atom.c
index e6f17be..ac51afc 100644
--- a/memory/atom.c
+++ b/memory/atom.c
@@ -16,7 +16,6 @@
#include <string.h>
#include <ctype.h>
-#include "atom.h"
#include "instance.h"
#include "ldt.h"
#include "stackframe.h"
@@ -39,6 +38,20 @@
#define GET_ATOM_TABLE(sel) ((ATOMTABLE*)PTR_SEG_OFF_TO_LIN(sel, \
((INSTANCEDATA*)PTR_SEG_OFF_TO_LIN(sel,0))->atomtable))
+
+typedef struct
+{
+ HANDLE16 next;
+ WORD refCount;
+ BYTE length;
+ BYTE str[1];
+} ATOMENTRY;
+
+typedef struct
+{
+ WORD size;
+ HANDLE16 entries[1];
+} ATOMTABLE;
static WORD ATOM_GlobalTable = 0;
@@ -107,16 +120,18 @@
*/
static ATOMTABLE *ATOM_GetTable(
WORD selector, /* [in] Segment */
- BOOL32 create /* [in] Create */
-) {
+ BOOL32 create /* [in] Create */ )
+{
INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 );
- if (!ptr->atomtable)
+ if (ptr->atomtable)
{
- if (!create) return NULL;
- if (!ATOM_InitTable( selector, DEFAULT_ATOMTABLE_SIZE )) return NULL;
- /* Reload ptr in case it moved in linear memory */
- ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 );
+ ATOMTABLE *table = (ATOMTABLE *)((char *)ptr + ptr->atomtable);
+ if (table->size) return table;
}
+ if (!create) return NULL;
+ if (!ATOM_InitTable( selector, DEFAULT_ATOMTABLE_SIZE )) return NULL;
+ /* Reload ptr in case it moved in linear memory */
+ ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 );
return (ATOMTABLE *)((char *)ptr + ptr->atomtable);
}
@@ -339,6 +354,7 @@
*/
WORD WINAPI InitAtomTable16( WORD entries )
{
+ if (!entries) entries = DEFAULT_ATOMTABLE_SIZE; /* sanity check */
return ATOM_InitTable( CURRENT_DS, entries );
}
diff --git a/misc/ddeml.c b/misc/ddeml.c
index 9916ae1..fdd4215 100644
--- a/misc/ddeml.c
+++ b/misc/ddeml.c
@@ -9,7 +9,7 @@
#include "ddeml.h"
#include "debug.h"
-#include "atom.h"
+#include "windows.h"
/* FIXME: What are these values? */
#define DMLERR_NO_ERROR 0
diff --git a/windows/class.c b/windows/class.c
index a69d7a7..2f15ee4 100644
--- a/windows/class.c
+++ b/windows/class.c
@@ -18,7 +18,6 @@
#include "heap.h"
#include "win.h"
#include "dce.h"
-#include "atom.h"
#include "ldt.h"
#include "toolhelp.h"
#include "winproc.h"
diff --git a/windows/message.c b/windows/message.c
index 907c7c4..f3b0c96 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -19,7 +19,6 @@
#include "input.h"
#include "spy.h"
#include "winpos.h"
-#include "atom.h"
#include "dde.h"
#include "queue.h"
#include "winproc.h"