Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: third_party/yasm/patched-yasm/libyasm/linemap.c

Issue 6170009: Update our yasm copy to yasm 1.1.0 (Part 1: yasm side)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/yasm/patched-yasm/libyasm/linemap.h ('k') | third_party/yasm/patched-yasm/libyasm/objfmt.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/yasm/patched-yasm/libyasm/linemap.c
===================================================================
--- third_party/yasm/patched-yasm/libyasm/linemap.c (revision 71129)
+++ third_party/yasm/patched-yasm/libyasm/linemap.c (working copy)
@@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "util.h"
-/*@unused@*/ RCSID("$Id: linemap.c 1896 2007-07-15 21:54:11Z peter $");
+/*@unused@*/ RCSID("$Id: linemap.c 2259 2010-01-03 01:58:23Z peter $");
#include "coretype.h"
#include "hamt.h"
@@ -80,23 +80,41 @@
void
yasm_linemap_set(yasm_linemap *linemap, const char *filename,
- unsigned long file_line, unsigned long line_inc)
+ unsigned long virtual_line, unsigned long file_line,
+ unsigned long line_inc)
{
char *copy;
+ unsigned long i;
int replace = 0;
- line_mapping *mapping;
+ line_mapping *mapping = NULL;
- /* Create a new mapping in the map */
- if (linemap->map_size >= linemap->map_allocated) {
- /* allocate another size bins when full for 2x space */
- linemap->map_vector =
- yasm_xrealloc(linemap->map_vector, 2*linemap->map_allocated
- *sizeof(line_mapping));
- linemap->map_allocated *= 2;
+ if (virtual_line == 0) {
+ virtual_line = linemap->current;
}
- mapping = &linemap->map_vector[linemap->map_size];
- linemap->map_size++;
+ /* Replace all existing mappings that have line numbers >= this one. */
+ for (i = linemap->map_size; i > 0; i--) {
+ if (linemap->map_vector[i-1].line < virtual_line) {
+ if (i < linemap->map_size) {
+ mapping = &linemap->map_vector[i];
+ linemap->map_size = i + 1;
+ }
+ break;
+ }
+ }
+
+ if (mapping == NULL) {
+ /* Create a new mapping in the map */
+ if (linemap->map_size >= linemap->map_allocated) {
+ /* allocate another size bins when full for 2x space */
+ linemap->map_vector = yasm_xrealloc(linemap->map_vector,
+ 2*linemap->map_allocated*sizeof(line_mapping));
+ linemap->map_allocated *= 2;
+ }
+ mapping = &linemap->map_vector[linemap->map_size];
+ linemap->map_size++;
+ }
+
/* Fill it */
if (!filename) {
@@ -115,7 +133,7 @@
/*@=aliasunique@*/
}
- mapping->line = linemap->current;
+ mapping->line = virtual_line;
mapping->file_line = file_line;
mapping->line_inc = line_inc;
}
@@ -128,14 +146,14 @@
line_mapping *mapping;
linemap->current++;
- yasm_linemap_set(linemap, filename, file_line, 0);
+ yasm_linemap_set(linemap, filename, 0, file_line, 0);
mapping = &linemap->map_vector[linemap->map_size-1];
line = linemap->current;
linemap->current++;
- yasm_linemap_set(linemap, mapping->filename,
+ yasm_linemap_set(linemap, mapping->filename, 0,
mapping->file_line +
mapping->line_inc*(linemap->current-2-mapping->line),
mapping->line_inc);
@@ -249,7 +267,7 @@
mapping = &linemap->map_vector[vindex];
*filename = mapping->filename;
- *file_line = mapping->file_line + mapping->line_inc*(line-mapping->line);
+ *file_line = (line ? mapping->file_line + mapping->line_inc*(line-mapping->line) : 0);
}
int
« no previous file with comments | « third_party/yasm/patched-yasm/libyasm/linemap.h ('k') | third_party/yasm/patched-yasm/libyasm/objfmt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698