comparison src/share/vm/adlc/filebuff.cpp @ 605:98cb887364d3

6810672: Comment typos Summary: I have collected some typos I have found while looking at the code. Reviewed-by: kvn, never
author twisti
date Fri, 27 Feb 2009 13:27:09 -0800
parents dbbe28fc66b5
children c18cbe5936b8
comparison
equal deleted inserted replaced
604:ec59443af135 605:98cb887364d3
48 _bigbuf = new char[_bufferSize]; // Create buffer to hold text for parser 48 _bigbuf = new char[_bufferSize]; // Create buffer to hold text for parser
49 if( !_bigbuf ) { 49 if( !_bigbuf ) {
50 file_error(SEMERR, 0, "Buffer allocation failed\n"); 50 file_error(SEMERR, 0, "Buffer allocation failed\n");
51 exit(1); // Exit on allocation failure 51 exit(1); // Exit on allocation failure
52 } 52 }
53 *_bigbuf = '\n'; // Lead with a sentinal newline 53 *_bigbuf = '\n'; // Lead with a sentinel newline
54 _buf = _bigbuf+1; // Skip sentinal 54 _buf = _bigbuf+1; // Skip sentinel
55 _bufmax = _buf; // Buffer is empty 55 _bufmax = _buf; // Buffer is empty
56 _bufeol = _bigbuf; // _bufeol points at sentinal 56 _bufeol = _bigbuf; // _bufeol points at sentinel
57 _filepos = -1; // filepos is in sync with _bufeol 57 _filepos = -1; // filepos is in sync with _bufeol
58 _bufoff = _offset = 0L; // Offset at file start 58 _bufoff = _offset = 0L; // Offset at file start
59 59
60 _bufmax += fread(_buf, 1, _bufferSize-2, _fp->_fp); // Fill buffer & set end value 60 _bufmax += fread(_buf, 1, _bufferSize-2, _fp->_fp); // Fill buffer & set end value
61 if (_bufmax == _buf) { 61 if (_bufmax == _buf) {
62 file_error(SEMERR, 0, "File read error, no input read\n"); 62 file_error(SEMERR, 0, "File read error, no input read\n");
63 exit(1); // Exit on read error 63 exit(1); // Exit on read error
64 } 64 }
65 *_bufmax = '\n'; // End with a sentinal new-line 65 *_bufmax = '\n'; // End with a sentinel new-line
66 *(_bufmax+1) = '\0'; // Then end with a sentinal NULL 66 *(_bufmax+1) = '\0'; // Then end with a sentinel NULL
67 } 67 }
68 68
69 //------------------------------~FileBuff-------------------------------------- 69 //------------------------------~FileBuff--------------------------------------
70 // Nuke the FileBuff 70 // Nuke the FileBuff
71 FileBuff::~FileBuff() { 71 FileBuff::~FileBuff() {
79 // Check for end of file & return NULL 79 // Check for end of file & return NULL
80 if (_bufeol >= _bufmax) return NULL; 80 if (_bufeol >= _bufmax) return NULL;
81 81
82 _linenum++; 82 _linenum++;
83 retval = ++_bufeol; // return character following end of previous line 83 retval = ++_bufeol; // return character following end of previous line
84 if (*retval == '\0') return NULL; // Check for EOF sentinal 84 if (*retval == '\0') return NULL; // Check for EOF sentinel
85 // Search for newline character which must end each line 85 // Search for newline character which must end each line
86 for(_filepos++; *_bufeol != '\n'; _bufeol++) 86 for(_filepos++; *_bufeol != '\n'; _bufeol++)
87 _filepos++; // keep filepos in sync with _bufeol 87 _filepos++; // keep filepos in sync with _bufeol
88 // _bufeol & filepos point at end of current line, so return pointer to start 88 // _bufeol & filepos point at end of current line, so return pointer to start
89 return retval; 89 return retval;