diff options
author | jkim <jkim@FreeBSD.org> | 2013-05-17 23:13:40 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2013-05-17 23:13:40 +0000 |
commit | af69f95bba3597db53a980597cfd371c9f6ee7cf (patch) | |
tree | 740dae2325e162bb086ea6e7e5d481c4b669e232 /source/components/debugger/dbhistry.c | |
parent | 00f95aec269522bc092cf85fe57fcfc19efecec9 (diff) | |
download | FreeBSD-src-af69f95bba3597db53a980597cfd371c9f6ee7cf.zip FreeBSD-src-af69f95bba3597db53a980597cfd371c9f6ee7cf.tar.gz |
Import ACPICA 20130517.
Diffstat (limited to 'source/components/debugger/dbhistry.c')
-rw-r--r-- | source/components/debugger/dbhistry.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/source/components/debugger/dbhistry.c b/source/components/debugger/dbhistry.c index c3933d3..ff11604 100644 --- a/source/components/debugger/dbhistry.c +++ b/source/components/debugger/dbhistry.c @@ -54,12 +54,12 @@ #define HI_NO_HISTORY 0 #define HI_RECORD_HISTORY 1 -#define HISTORY_SIZE 20 +#define HISTORY_SIZE 40 typedef struct HistoryInfo { - char Command[80]; + char *Command; UINT32 CmdNum; } HISTORY_INFO; @@ -88,13 +88,35 @@ void AcpiDbAddToHistory ( char *CommandLine) { + UINT16 CmdLen; + UINT16 BufferLen; /* Put command into the next available slot */ + CmdLen = (UINT16) ACPI_STRLEN (CommandLine); + if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL) + { + BufferLen = (UINT16) ACPI_STRLEN ( + AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command); + if (CmdLen > BufferLen) + { + AcpiOsFree (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex]. + Command); + AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command = + AcpiOsAllocate (CmdLen + 1); + } + } + else + { + AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command = + AcpiOsAllocate (CmdLen + 1); + } + ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command, CommandLine); - AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum = AcpiGbl_NextCmdNum; + AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum = + AcpiGbl_NextCmdNum; /* Adjust indexes */ @@ -148,8 +170,12 @@ AcpiDbDisplayHistory ( for (i = 0; i < AcpiGbl_NumHistory; i++) { - AcpiOsPrintf ("%ld %s\n", AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum, - AcpiGbl_HistoryBuffer[HistoryIndex].Command); + if (AcpiGbl_HistoryBuffer[HistoryIndex].Command) + { + AcpiOsPrintf ("%3ld %s\n", + AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum, + AcpiGbl_HistoryBuffer[HistoryIndex].Command); + } HistoryIndex++; if (HistoryIndex >= HISTORY_SIZE) @@ -199,7 +225,7 @@ AcpiDbGetFromHistory ( { if (AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum == CmdNum) { - /* Found the commnad, return it */ + /* Found the command, return it */ return (AcpiGbl_HistoryBuffer[HistoryIndex].Command); } |