From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752649AbcAGID3 (ORCPT ); Thu, 7 Jan 2016 03:03:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35824 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751060AbcAGID0 (ORCPT ); Thu, 7 Jan 2016 03:03:26 -0500 Date: Thu, 7 Jan 2016 09:03:20 +0100 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Stephane Eranian , Andi Kleen , Masami Hiramatsu , Wang Nan Subject: Re: [RFC/PATCH v2] perf report: Show random usage tip on the help line Message-ID: <20160107080320.GB20434@krava.brq.redhat.com> References: <1452152782-26892-1-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1452152782-26892-1-git-send-email-namhyung@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 07, 2016 at 04:46:22PM +0900, Namhyung Kim wrote: SNIP > +const char *perf_report_tip(const char *dirname) > +{ > + struct strlist *tips; > + struct str_node *node; > + char *tip = NULL; > + struct strlist_config conf = { > + .dirname = system_path(dirname) , > + }; > + > + tips = strlist__new("tips.txt", &conf); > + if (tips == NULL || strlist__nr_entries(tips) == 1) { > + tip = (char *)"Cannot find tips.txt file"; > + goto out; > + } > + > + node = strlist__entry(tips, random() % strlist__nr_entries(tips)); > + if (asprintf(&tip, "Tip: %s", node->s) < 0) > + tip = (char *)"Not enough memory"; ^^^ this could be tip = (char *) "Tip: get more memory!"; ;-) jirka