@@ -375,67 +375,6 @@ char* fgets(char* buf, int max_size, FILE* fp) {
375
375
return nullptr ;
376
376
}
377
377
378
- /* *
379
- * @brief to get an arbitrary long input line and cut off any
380
- * comment part
381
- *
382
- * the getline function is exaly like the __get_delim function
383
- * in GNU with '\n' delimiter. As a result, to make the function
384
- * behaviour identical for Windows (\r\n) and Linux (\n) compiler
385
- * macros for checking operating systems have been used.
386
- *
387
- * @note user need to take care of the given pointer,
388
- * which will be dynamically allocated by getdelim
389
- */
390
- char * getline (char *& _lineptr, FILE* _stream) {
391
- int i;
392
- int ch;
393
- size_t _n = 0 ;
394
- ssize_t nread;
395
-
396
- #if defined(__unix__)
397
- nread = getdelim (&_lineptr, &_n, ' \n ' , _stream);
398
- #elif defined(_WIN32)
399
- #define __WIN_NLTK " \r\n "
400
- nread = getdelim (&_lineptr, &_n, __WIN_NLTK, _stream);
401
- #endif
402
-
403
- if (nread == -1 ) {
404
- int errsv = errno;
405
- std::string error_msg;
406
-
407
- if (errsv == EINVAL)
408
- error_msg = string_fmt (" [%s] Bad arguments (_lineptr is NULL, or _stream is not valid)." , strerror (errsv));
409
- else if (errsv == ENOMEM)
410
- error_msg = string_fmt (" [%s] Allocation or reallocation of the line buffer failed." , strerror (errsv));
411
- else
412
- /* end of file so it will return null */
413
- return nullptr ;
414
-
415
- /* getline was unsuccessful, so error */
416
- throw VtrError (string_fmt (" Error -- %s\n " ,
417
- error_msg.c_str ()),
418
- __FILE__, __LINE__);
419
- return nullptr ;
420
- }
421
-
422
- cont = 0 ; /* line continued? */
423
- file_line_number++; /* global variable */
424
-
425
- for (i = 0 ; i < nread; i++) { /* Keep going until the line finishes */
426
-
427
- ch = _lineptr[i];
428
-
429
- if (ch == ' #' ) { /* comment */
430
- _lineptr[i] = ' \0 ' ;
431
- /* skip the rest of the line */
432
- break ;
433
- }
434
- }
435
-
436
- return (_lineptr);
437
- }
438
-
439
378
// /@brief Returns line number of last opened and read file
440
379
int get_file_line_number_of_last_opened_file () {
441
380
return file_line_number;
0 commit comments