SimGrid (3.10) NOT RELEASED; urgency=low
+ XBT:
+ * Our own implementation of getline is renamed xbt_getline.
+
Java:
* Reintegrate Java to the main archive as desynchronizing these
package is not acceptable anymore (Java is now considered stable)
- * Bugfix: Task.setDataSize() only changed the C world, not the value
+ * Bugfix: Task.setDataSize() only changed the C world, not the value
cached in the Java world
-- $date Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
@simgrid_need_vasprintf@
#include <stdio.h> /* FILE, getline if it exists */
-
-/* Use that config to declare missing elements */
-#ifdef SIMGRID_NEED_GETLINE
-#include <stdlib.h> /* size_t */
-XBT_PUBLIC(long) getline(char **lineptr, size_t * n, FILE * stream);
-#endif
+#include <stdlib.h> /* size_t, ssize_t */
+XBT_PUBLIC(ssize_t) xbt_getline(char **lineptr, size_t * n, FILE * stream);
#include <stdarg.h>
FILE *fp;
char *line = NULL; /* Temporal storage for each line that is readed */
ssize_t read; /* Number of bytes readed */
- size_t n = 0; /* Amount of bytes to read by getline */
+ size_t n = 0; /* Amount of bytes to read by xbt_getline */
char *lfields[7];
int i, plt_found = 0;
xbt_abort();
}
- while ((read = getline(&line, &n, fp)) != -1 && plt_found != 2) {
+ while ((read = xbt_getline(&line, &n, fp)) != -1 && plt_found != 2) {
if(n == 0)
continue;
FILE *fp;
char *line = NULL; /* Temporal storage for each line that is readed */
ssize_t read; /* Number of bytes readed */
- size_t n = 0; /* Amount of bytes to read by getline */
+ size_t n = 0; /* Amount of bytes to read by xbt_getline */
char *lfields[7];
int i, plt_found = 0;
xbt_abort();
}
- while ((read = getline(&line, &n, fp)) != -1 && plt_found != 2) {
+ while ((read = xbt_getline(&line, &n, fp)) != -1 && plt_found != 2) {
if(n == 0)
continue;
int cursor_remove;
xbt_dynar_t split = NULL;
- while ((read = getline(&line, &n, fp)) != -1) {
+ while ((read = xbt_getline(&line, &n, fp)) != -1) {
/* Wipeout the new line character */
line[read - 1] = '\0';
xbt_dynar_free(&split);
free(loc_expr);
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
if(read != -1){
line[read - 1] = '\0';
xbt_str_strip_spaces(line);
int new_frame = 0, new_variable = 0;
dw_frame_t variable_frame, subroutine_frame = NULL;
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
while (read != -1) {
if(n == 0){
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
continue;
}
line[read - 1] = '\0';
if(strlen(line) == 0){
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
continue;
}
xbt_str_strip_spaces(line);
if(line[0] != '<'){
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
continue;
}
subprogram_start = strdup(strtok(NULL, "<"));
xbt_str_rtrim(subprogram_start, ">:");
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
while(read != -1){
if(n == 0){
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
continue;
}
line[read - 1] = '\0';
if(strlen(line) == 0){
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
continue;
}
}
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
}
origin = strdup(strtok(NULL, "<"));
xbt_str_rtrim(origin, ">:");
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
while(read != -1){
if(n == 0){
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
continue;
}
line[read - 1] = '\0';
if(strlen(line) == 0){
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
continue;
}
}
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
}
origin = strdup(strtok(NULL, "<"));
xbt_str_rtrim(origin, ">:");
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
while(read != -1){
line[read - 1] = '\0';
if(n == 0){
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
continue;
}
if(strlen(line) == 0){
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
continue;
}
subroutine_frame->high_pc = (void *)strtoul(xbt_dynar_get_as(split, 3, char *), NULL, 16);
}
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
}
}else{
- read = getline(&line, &n, fp);
+ read = xbt_getline(&line, &n, fp);
}
int type = strcmp(elf_file, xbt_binary_name); /* 0 = binary, other = libsimgrid */
- while ((read = getline(&line, &n, fp)) != -1){
+ while ((read = xbt_getline(&line, &n, fp)) != -1){
if(n == 0)
continue;
FILE *fp; /* File pointer to process's proc maps file */
char *line = NULL; /* Temporal storage for each line that is readed */
ssize_t read; /* Number of bytes readed */
- size_t n = 0; /* Amount of bytes to read by getline */
+ size_t n = 0; /* Amount of bytes to read by xbt_getline */
memory_map_t ret = NULL; /* The memory map to return */
/* The following variables are used during the parsing of the file "maps" */
ret = xbt_new0(s_memory_map_t, 1);
/* Read one line at the time, parse it and add it to the memory map to be returned */
- while ((read = getline(&line, &n, fp)) != -1) {
+ while ((read = xbt_getline(&line, &n, fp)) != -1) {
//fprintf(stderr,"%s", line);
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "simgrid_config.h" //For getline, keep that include first
-
#include "msg_private.h"
#include "xbt/str.h"
#include "xbt/dynar.h"
surf_stat_t content;
- while ((read = getline(&line, &len, file)) != -1) {
+ while ((read = xbt_getline(&line, &len, file)) != -1) {
if (read){
content = xbt_new0(s_surf_stat_t,1);
if(sscanf(line,"%s %d %s %s %ld %s %s %s",user_rights,&nb,user,group,&size,date,time,path)==8) {
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "simgrid_config.h" /* getline */
#include <errno.h>
#include <stdlib.h>
#include "xbt/sysdep.h"
//read the number of nodes
size_t size;
char *nnodes_str = NULL;
- read = getline (&nnodes_str, &size, file);
+ read = xbt_getline (&nnodes_str, &size, file);
if (read == -1)
- THROWF(system_error, 0, "getline failed to read the number of nodes (errno = %d)", errno);
+ THROWF(system_error, 0, "xbt_getline failed to read the number of nodes (errno = %d)", errno);
int i, nnodes = atoi (nnodes_str);
free (nnodes_str);
//read all nodes
for (i = 0; i < nnodes; i++){
char *node_str = NULL;
- read = getline (&node_str, &size, file);
+ read = xbt_getline (&node_str, &size, file);
if (read == -1)
- THROWF(system_error, 0, "getline failed to read all nodes (errno = %d)", errno);
+ THROWF(system_error, 0, "xbt_getline failed to read all nodes (errno = %d)", errno);
xbt_node_t n;
char *name = xbt_strdup (node_str);
xbt_str_subst (name, '\n', '\0', 0);
//read the number of edges
char *nedges_str = NULL;
- read = getline (&nedges_str, &size, file);
+ read = xbt_getline (&nedges_str, &size, file);
if (read == -1)
- THROWF(system_error, 0, "getline failed to read the number of edges (errno = %d)", errno);
+ THROWF(system_error, 0, "xbt_getline failed to read the number of edges (errno = %d)", errno);
int nedges = atoi (nedges_str);
free (nedges_str);
//read all edges
for (i = 0; i < nedges; i++){
char *edge_str = NULL, edge_id[200], node_source[200], node_target[200];
- read = getline (&edge_str, &size, file);
+ read = xbt_getline (&edge_str, &size, file);
if (read == -1)
- THROWF(system_error, 0, "getline failed to read all edges (errno = %d)", errno);
+ THROWF(system_error, 0, "xbt_getline failed to read all edges (errno = %d)", errno);
sscanf (edge_str, "%s %s %s", edge_id, node_source, node_target);
free (edge_str);
xbt_str_subst (edge_id, '\n', '\0', 0);
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "simgrid_config.h" //For getline, keep that include first
#include "internal_config.h"
#include <errno.h>
{
ssize_t read;
xbt_dynar_t d;
- read = getline(&reader->line, &reader->line_len, reader->fp);
+ read = xbt_getline(&reader->line, &reader->line_len, reader->fp);
//XBT_INFO("got from trace: %s",reader->line);
reader->linenum++;
if (read==-1)
}
// Read lines until I reach something for me (which breaks in loop body)
// or end of file reached
- while (getline(&action_line, &action_len, action_fp) != -1) {
+ while (xbt_getline(&action_line, &action_len, action_fp) != -1) {
// cleanup and split the string I just read
char *comment = strchr(action_line, '#');
if (comment != NULL)
return res;
}
-#if defined(SIMGRID_NEED_GETLINE) || defined(DOXYGEN)
/** @brief Get a single line from the stream (reimplementation of the GNU getline)
*
- * This is a redefinition of the GNU getline function, used on platforms where it does not exists.
+ * This is a redefinition of the GNU getline function, used on platforms where
+ * it does not exists.
*
- * getline() reads an entire line from stream, storing the address of the buffer
- * containing the text into *buf. The buffer is null-terminated and includes
- * the newline character, if one was found.
+ * xbt_getline() reads an entire line from stream, storing the address of the
+ * buffer containing the text into *buf. The buffer is null-terminated and
+ * includes the newline character, if one was found.
*
- * If *buf is NULL, then getline() will allocate a buffer for storing the line,
- * which should be freed by the user program. Alternatively, before calling getline(),
- * *buf can contain a pointer to a malloc()-allocated buffer *n bytes in size. If the buffer
- * is not large enough to hold the line, getline() resizes it with realloc(), updating *buf and *n
- * as necessary. In either case, on a successful call, *buf and *n will be updated to
- * reflect the buffer address and allocated size respectively.
+ * If *buf is NULL, then xbt_getline() will allocate a buffer for storing the
+ * line, which should be freed by the user program.
+ *
+ * Alternatively, before calling xbt_getline(), *buf can contain a pointer to a
+ * malloc()-allocated buffer *n bytes in size. If the buffer is not large
+ * enough to hold the line, xbt_getline() resizes it with realloc(), updating
+ * *buf and *n as necessary.
+ *
+ * In either case, on a successful call, *buf and *n will be updated to reflect
+ * the buffer address and allocated size respectively.
*/
-long getline(char **buf, size_t * n, FILE * stream)
+ssize_t xbt_getline(char **buf, size_t * n, FILE * stream)
{
-
+#if !defined(SIMGRID_NEED_GETLINE)
+ return getline(buf, n, stream);
+#else
size_t i;
int ch;
(*buf)[i] = '\0';
return (ssize_t) i;
+#endif
}
-#endif /* HAVE_GETLINE */
-
/*
* Diff related functions
*
#pragma hdrstop
#endif
-#include "simgrid_config.h" //For getline, keep that include first
-
#include "tesh.h"
#include "xbt.h"
buff = xbt_strbuff_new();
rctx = rctx_new();
- while (getline(&line, &len, IN) != -1) {
+ while (xbt_getline(&line, &len, IN) != -1) {
line_num++;
/* Count the line length while checking wheather it's blank */